2024-09-04 12:40:55 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Sebastian Pipping <sebastian@pipping.org>
|
|
|
|
Date: Mon, 19 Aug 2024 22:26:07 +0200
|
2024-09-04 19:10:33 -04:00
|
|
|
Subject: [PATCH] lib: Reject negative len for XML_ParseBuffer
|
2024-09-04 12:40:55 -04:00
|
|
|
|
|
|
|
Reported by TaiYou
|
|
|
|
---
|
|
|
|
lib/xmlparse.c | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
2024-09-14 12:44:16 -04:00
|
|
|
index c84b5ed..02f71c4 100644
|
2024-09-04 12:40:55 -04:00
|
|
|
--- a/lib/xmlparse.c
|
|
|
|
+++ b/lib/xmlparse.c
|
2024-09-14 12:44:16 -04:00
|
|
|
@@ -1874,6 +1874,12 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal) {
|
2024-09-04 12:40:55 -04:00
|
|
|
|
|
|
|
if (parser == NULL)
|
|
|
|
return XML_STATUS_ERROR;
|
|
|
|
+
|
|
|
|
+ if (len < 0) {
|
|
|
|
+ parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT;
|
|
|
|
+ return XML_STATUS_ERROR;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
switch (parser->m_parsingStatus.parsing) {
|
|
|
|
case XML_SUSPENDED:
|
|
|
|
parser->m_errorCode = XML_ERROR_SUSPENDED;
|