Initialize variable on stack to avoid crash in libxml.

with mbuhl@
This commit is contained in:
bluhm 2022-11-21 17:55:43 +00:00
parent 57291d9468
commit 9b265434c3
2 changed files with 44 additions and 0 deletions

View File

@ -1,6 +1,7 @@
COMMENT = perl binding for libxml2
DISTNAME = XML-LibXML-2.0208
REVISION = 0
EPOCH = 0
CATEGORIES = textproc

View File

@ -0,0 +1,43 @@
https://github.com/shlomif/perl-XML-LibXML/pull/73
Index: LibXML.xs
--- LibXML.xs.orig
+++ LibXML.xs
@@ -4025,18 +4025,11 @@ is_valid(self, ...)
CODE:
INIT_ERROR_HANDLER;
+ memset(&cvp, 0, sizeof(cvp));
cvp.userData = saved_error;
cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx;
cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx;
- /* we need to initialize the node stack, because perl might
- * already have messed it up.
- */
- cvp.nodeNr = 0;
- cvp.nodeTab = NULL;
- cvp.vstateNr = 0;
- cvp.vstateTab = NULL;
-
PmmClearPSVI(self);
PmmInvalidatePSVI(self);
if (items > 1) {
@@ -4065,16 +4058,10 @@ validate(self, ...)
CODE:
INIT_ERROR_HANDLER;
+ memset(&cvp, 0, sizeof(cvp));
cvp.userData = saved_error;
cvp.error = (xmlValidityErrorFunc)LibXML_validity_error_ctx;
cvp.warning = (xmlValidityWarningFunc)LibXML_validity_warning_ctx;
- /* we need to initialize the node stack, because perl might
- * already have messed it up.
- */
- cvp.nodeNr = 0;
- cvp.nodeTab = NULL;
- cvp.vstateNr = 0;
- cvp.vstateTab = NULL;
PmmClearPSVI(self);
PmmInvalidatePSVI(self);