1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-09 04:58:16 +03:00

Allow zero sized memory input buffers

Useful for a fuzz target I'm working on.
This commit is contained in:
Nick Wellnhofer 2017-06-08 22:36:09 +02:00
parent 91e5496780
commit 94f6ce838c
2 changed files with 3 additions and 3 deletions

2
buf.c
View File

@ -231,7 +231,7 @@ xmlBufPtr
xmlBufCreateStatic(void *mem, size_t size) {
xmlBufPtr ret;
if ((mem == NULL) || (size == 0))
if (mem == NULL)
return(NULL);
ret = (xmlBufPtr) xmlMalloc(sizeof(xmlBuf));

View File

@ -3027,7 +3027,7 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
int errcode;
if (size <= 0) return(NULL);
if (size < 0) return(NULL);
if (mem == NULL) return(NULL);
ret = xmlAllocParserInputBuffer(enc);
@ -3063,7 +3063,7 @@ xmlParserInputBufferCreateStatic(const char *mem, int size,
xmlCharEncoding enc) {
xmlParserInputBufferPtr ret;
if (size <= 0) return(NULL);
if (size < 0) return(NULL);
if (mem == NULL) return(NULL);
ret = (xmlParserInputBufferPtr) xmlMalloc(sizeof(xmlParserInputBuffer));