diff options
author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2022-12-01 13:23:09 +0000 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-12-01 15:31:25 +0000 |
commit | 4b959ee1680e2ffbf49cd260cbef08f94e0ab6b0 (patch) | |
tree | b7931553c985544839c84298852d5b78a4ca19a2 /xmllint.c | |
parent | c715ded0861af956ba584f566bc7db6717f519d0 (diff) | |
download | libxml2-4b959ee1680e2ffbf49cd260cbef08f94e0ab6b0.tar.gz |
Remove hacky heuristic from b2dc5675e94aa6b5557ba63f7d66b0f08dd17e4d
Checking whether the context is close to the parent context by hardcoding
250 is not portable (I noticed tests were failing on Morello since the value
is 288 there due to pointers being 128 bits). Instead we should ensure
that the XML_VCTXT_USE_PCTXT flag is not set in cases where the user data
is not actually a parser context (or ideally add a separate field but that
would be an ABI break.
From what I can see in the source, the XML_VCTXT_USE_PCTXT is only set if
the userData field points to a valid context, and if this is not the case
the flag should be cleared when changing userData rather than relying on
the offset between the two. Looking at the history, I think
d7cb33cf44aa688f24215c9cd398c1a26f0d25ff fixed most of the need for this
workaround, but it looks like there are a few more locations that need
updating; This commit changes two more places to set/clear/copy the
XML_VCTXT_USE_PCTXT flag, so this heuristic should not be needed anymore.
I've also drop two = NULL assignment in xmllint since this is not needed
after a call to memset().
There was also an uninitialized vctxt.flags (and other fields) in
`xmlShellValidate()`, which I've fixed by adding a memset() call.
Diffstat (limited to 'xmllint.c')
-rw-r--r-- | xmllint.c | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -2711,7 +2711,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { xmlFreeDtd(dtd); return; } - cvp->userData = NULL; cvp->error = xmlGenericError; cvp->warning = xmlGenericError; @@ -2749,7 +2748,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { if ((timing) && (!repeat)) { startTimer(); } - cvp->userData = NULL; cvp->error = xmlGenericError; cvp->warning = xmlGenericError; if (!xmlValidateDocument(cvp, doc)) { |