• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 9feafbc5c5cce13852062a527d719ecce6b54661 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sun, 13 Nov 2022 16:56:10 +0100
4Subject: [PATCH] io: Check for memory buffer early in xmlParserInputGrow
5
6Reference:https://github.com/GNOME/libxml2/commit/9feafbc5c5cce13852062a527d719ecce6b54661
7Conflict:NA
8---
9 parserInternals.c | 8 ++++----
10 1 file changed, 4 insertions(+), 4 deletions(-)
11
12diff --git a/parserInternals.c b/parserInternals.c
13index b8eab4b..0ef44fe 100644
14--- a/parserInternals.c
15+++ b/parserInternals.c
16@@ -310,6 +310,9 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
17     if (in->cur == NULL) return(-1);
18     if (in->buf->buffer == NULL) return(-1);
19
20+    /* Don't grow memory buffers. */
21+    if (in->buf->readcallback == NULL) return(0);
22+
23     CHECK_BUFFER(in);
24
25     indx = in->cur - in->base;
26@@ -319,10 +322,7 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) {
27
28         return(0);
29     }
30-    if (in->buf->readcallback != NULL) {
31-	ret = xmlParserInputBufferGrow(in->buf, len);
32-    } else
33-        return(0);
34+    ret = xmlParserInputBufferGrow(in->buf, len);
35
36     in->base = xmlBufContent(in->buf->buffer);
37     in->cur = in->base + indx;
38--
392.27.0
40
41