diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-12 19:06:19 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-03-12 19:06:19 +0100 |
commit | b75976e02999c453ae80bb1ade72f704a78b95ce (patch) | |
tree | 06a02029b9d78ca43da5a4189d83eebaa4fb70c6 | |
parent | 9a6ca816124d73a9688655d7683c5c977cbc43c8 (diff) | |
download | libxml2-b75976e02999c453ae80bb1ade72f704a78b95ce.tar.gz |
parser: Use size_t when subtracting input buffer pointers
Avoid integer overflows.
-rw-r--r-- | HTMLparser.c | 2 | ||||
-rw-r--r-- | parser.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/HTMLparser.c b/HTMLparser.c index 3b179120..ae84e59b 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -3875,7 +3875,7 @@ htmlCheckEncodingDirect(htmlParserCtxtPtr ctxt, const xmlChar *encoding) { (ctxt->input->buf->raw != NULL) && (ctxt->input->buf->buffer != NULL)) { int nbchars; - int processed; + size_t processed; /* * convert as much as possible to the parser reading buffer. @@ -9350,7 +9350,7 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, int maxatts = ctxt->maxatts; int nratts, nbatts, nbdef, inputid; int i, j, nbNs, attval; - unsigned long cur; + size_t cur; int nsNr = ctxt->nsNr; if (RAW != '<') return(NULL); @@ -11422,7 +11422,8 @@ xmlCheckCdataPush(const xmlChar *utf, int len, int complete) { static int xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { int ret = 0; - int avail, tlen; + int tlen; + size_t avail; xmlChar cur, next; if (ctxt->input == NULL) |