[libxml2] Allow zero sized memory input buffers
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Allow zero sized memory input buffers
- Date: Sat, 10 Jun 2017 16:31:56 +0000 (UTC)
commit 94f6ce838c6a903ef5d0251f061a3af1816b4c50
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Jun 8 22:36:09 2017 +0200
Allow zero sized memory input buffers
Useful for a fuzz target I'm working on.
buf.c | 2 +-
xmlIO.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/buf.c b/buf.c
index 07922ff..3b76018 100644
--- a/buf.c
+++ b/buf.c
@@ -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));
diff --git a/xmlIO.c b/xmlIO.c
index 300ee47..8c6509d 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]