libxml2/backport-parser-Fix-potential-use-after-free-in-xmlParseCharD.patch
2024-05-06 16:53:04 +08:00

34 lines
825 B
Diff

From 90bcbcfcc72f0647233c0ae85f8dc0e31098530a Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, 20 Jul 2023 21:08:01 +0200
Subject: [PATCH] parser: Fix potential use-after-free in
xmlParseCharDataInternal
Return immediately if a SAX handler stops the parser.
Fixes #569.
Reference:https://github.com/GNOME/libxml2/commit/90bcbcfcc72f0647233c0ae85f8dc0e31098530a
Conflict:xmlParseCharData
---
parser.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/parser.c b/parser.c
index 204073e..b4fb58c 100644
--- a/parser.c
+++ b/parser.c
@@ -4538,6 +4538,8 @@ get_more:
line = ctxt->input->line;
col = ctxt->input->col;
}
+ if (ctxt->instate == XML_PARSER_EOF)
+ return;
}
ctxt->input->cur = in;
if (*in == 0xD) {
--
2.33.0