|
|
#include "libxml.h" | #include "libxml.h" |
#include <stdlib.h> | #include <stdlib.h> |
#include <string.h> | #include <string.h> |
|
#include <limits.h> |
#include <libxml/xmlmemory.h> | #include <libxml/xmlmemory.h> |
#include <libxml/tree.h> | #include <libxml/tree.h> |
#include <libxml/parser.h> | #include <libxml/parser.h> |
|
|
#include <libxml/HTMLtree.h> | #include <libxml/HTMLtree.h> |
#include <libxml/globals.h> | #include <libxml/globals.h> |
| |
|
/* Define SIZE_T_MAX unless defined through <limits.h>. */ |
|
#ifndef SIZE_T_MAX |
|
# define SIZE_T_MAX ((size_t)-1) |
|
#endif /* !SIZE_T_MAX */ |
|
|
/* #define DEBUG_SAX2 */ | /* #define DEBUG_SAX2 */ |
/* #define DEBUG_SAX2_TREE */ | /* #define DEBUG_SAX2_TREE */ |
| |
|
Lines 2455-2463
xmlSAX2Characters(void *ctx, const xmlCh
|
Link Here
|
|---|
|
(xmlDictOwns(ctxt->dict, lastChild->content))) { | (xmlDictOwns(ctxt->dict, lastChild->content))) { |
lastChild->content = xmlStrdup(lastChild->content); | lastChild->content = xmlStrdup(lastChild->content); |
} | } |
|
if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || |
|
(size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { |
|
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); |
|
return; |
|
} |
if (ctxt->nodelen + len >= ctxt->nodemem) { | if (ctxt->nodelen + len >= ctxt->nodemem) { |
xmlChar *newbuf; | xmlChar *newbuf; |
int size; |
size_t size; |
| |
size = ctxt->nodemem + len; | size = ctxt->nodemem + len; |
size *= 2; | size *= 2; |