1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-23 01:52:48 +03:00

parser: Fix in-parameter-entity and in-external-dtd checks

Use in ctxt->input->entity instead of ctxt->inputNr to determine whether
we are inside a parameter entity.

Stop using ctxt->external to check whether we're in an external DTD.
This is signaled by ctxt->inSubset == 2.
This commit is contained in:
Nick Wellnhofer
2023-12-26 02:10:35 +01:00
parent 477a7ed82c
commit d944a41515
11 changed files with 66 additions and 110 deletions

View File

@@ -96,7 +96,7 @@ def callback(ctx, str):
err = err + "%s" % (str)
libxml2.registerErrorHandler(callback, "")
parsing_error_files = ["766956", "cond_sect2", "t8", "t8a"]
parsing_error_files = ["766956", "cond_sect2", "t8", "t8a", "pe-in-text-decl"]
expect_parsing_error = [os.path.join(dir_prefix, f + ".xml") for f in parsing_error_files]
valid_files = glob.glob(os.path.join(dir_prefix, "*.x*"))
@@ -114,12 +114,11 @@ for file in valid_files:
if ret != 0 and file not in expect_parsing_error:
print("Error parsing and validating %s" % (file))
#sys.exit(1)
if (err):
if not(file in expect and err == expect[file]):
failures += 1
print("Error: ", err)
if file in expect:
print("Expected: ", expect[file])
if file in expect and err != expect[file]:
failures += 1
print("Error: ", err)
if file in expect:
print("Expected: ", expect[file])
if failures:
print("Failed %d tests" % failures)