1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
Commit Graph

54 Commits

Author SHA1 Message Date
Nick Wellnhofer
01411e7c5e Check for invalid redeclarations of predefined entities
Implement section "4.6 Predefined Entities" of the XML 1.0 spec and
check whether redeclarations of predefined entities match the original
definitions.

Note that some test cases declared

    <!ENTITY lt "<">

But the XML spec clearly states that this is illegal:

> If the entities lt or amp are declared, they MUST be declared as
> internal entities whose replacement text is a character reference to
> the respective character (less-than sign or ampersand) being escaped;
> the double escaping is REQUIRED for these entities so that references
> to them produce a well-formed result.

Also fixes #217 but the connection is only tangential. The integer
overflow discovered by fuzzing was more related to the fact that various
parts of the parser disagreed on whether to prefer predefined entities
over their redeclarations. The whole situation is a mess and even
depends on legacy parser options. But now that redeclarations are
validated, it shouldn't make a difference.

As noted in the added comment, this is also one of the cases where
overly defensive checks can hide interesting logic bugs from fuzzers.
2021-02-08 21:51:26 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Jan Pokorný
ea695ac0d6 Fix unability to RelaxNG-validate grammar with choice-based name class
Previously, test/relaxng/ambig_name-class2.xml would fail to validate
against test/relaxng/ambig_name-class2.rng:

> test/relaxng/ambig_name-class2.rng:4:
>   element attribute: Relax-NG parser error :
>       Found anyName attribute without oneOrMore ancestor
> Relax-NG schema test/relaxng/ambig_name-class2.rng failed to compile

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-08-25 13:29:04 +02:00
Jan Pokorný
8074b88179 Fix unability to validate ambiguously constructed interleave for RelaxNG
Previously, test/relaxng/ambig_name-class.xml would fail to validate
for a simple reason -- interleave within "open-name-class" context
is supposed to be fine with whatever else is pending the consumption,
since effectively, it's unrelated from a higher parsing perspective.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-08-25 13:29:04 +02:00
Nikolai Weibull
c64d4efb31 Remove redefined starts and defines inside include elements
When including a grammar from another grammar, we need to make sure that any
redefines of starts and includes that that grammar does inside any of its
include elements are also removed.
2018-11-29 21:06:06 +01:00
Nikolai Weibull
46da8fc529 Allow choice within choice in nameClass in RELAX NG
The pattern nameClass allows for nested choice elements, for example

  <name>
    <choice>
      <choice>
        <name>a</name>
        <name>b</name>
      </choice>
      <name>c</name>
    </choice>
  </name>

which is semantically equivalent to

  <name>
    <choice>
      <name>a</name>
      <name>b</name>
      <name>c</name>
    </choice>
  </name>

The old code didn’t handle this correctly, as it never expected a choice inside
another choice.  This patch fixes this by flattening any nested choices.

This pattern of nested choice elements comes up in RELAX NG simplification,
where all choice elements are rewritten in this nested manner, see section 4.12
of the RELAX NG specification.
2018-11-29 21:03:11 +01:00
Nikolai Weibull
4338c310eb Look inside divs for starts and defines inside include
RELAX NG allows for div elements inside of include elements.  We need to look
inside those div elements for start and define elements that may be redefining
start and define elements in the included grammar.
2018-11-29 21:00:46 +01:00
Audric Schiltknecht
cad102b861 Do normalize string-based datatype value in RelaxNG facet checking
Original patch is from Jan Pokorný <jpokorny redhat com>
https://mail.gnome.org/archives/xml/2013-November/msg00028.html

Improve it according to reviews and add test files.
2016-04-15 22:41:24 +08:00
Daniel Veillard
2fab235d10 Fix support for except in nameclasses
For https://bugzilla.gnome.org/show_bug.cgi?id=565219

The code was imply missing even if simple, added a few regression
tests.
2015-03-16 08:43:37 +08:00
Shaun McCance
6473a41a49 Implement choice for name classes on attributes
https://bugzilla.gnome.org/show_bug.cgi?id=710744
2013-11-28 16:09:00 +08:00
Daniel Veillard
aa422d9254 595792 fixing a RelaxNG bug introduced in 2.7.4
* relaxng.c: refs definitions added from inported schemas should not
  be processed as refs from the main schemas
* test/relaxng/595792* result/relaxng/595792*: add the test to the
  regression suite
2009-09-24 11:31:48 +02:00
Daniel Veillard
9332b48f16 Fix a Relaxng bug raised by libvirt test suite
* xmlregexp.c: other fixes in 2.7.4 raised this internal error
  when comparing ranges, this affects among others detection of
  the determinism
* test/relaxng/libvirt* result/relaxng/libvirt*: add a test case
  based on libvirt schemas and tests
2009-09-23 18:28:43 +02:00
Daniel Veillard
1ba2aca3eb 492317 Fix Relax-NG validation problems
* relaxng.c xmlregexp.c: a subtle problem when checking for compileable
  content model, if using the same elements in cases of choices. Handled
  by adding a special flag to the regexp compilation to detect
  transitions with different atoms using same strings.
* test/relaxng/492317* result/relaxng/492317*: add the test to the
  regression suite
2009-08-31 16:47:39 +02:00
Daniel Veillard
ec18c96008 558452 fight with reg test and error report
* relaxng.c: tiny fix and provide more context on some errors
* result/relaxng/558452_0* test/relaxng/558452*: add some regression
  tests for the bugs
* Makefile.am runtest.c: fight with the fact streaming error messages
  can differ due to missing node context
2009-08-26 18:37:43 +02:00
Daniel Veillard
e96b47fd3d fix xmlTextReaderSetup() description tests which were apparently never
* xmlreader.c: fix xmlTextReaderSetup() description
* test/relaxng/empty1.rng test/relaxng/comps_0.xml
  test/relaxng/empty1_0.xml test/relaxng/comps.rng
  test/relaxng/empty0.rng test/relaxng/empty0_0.xml
  test/relaxng/empty1_1.xml: tests which were apparently 
  never commited to CVS
Daniel

svn path=/trunk/; revision=3572
2007-01-04 17:28:35 +00:00
Daniel Veillard
be58a0a319 Adding test file, Daniel 2006-10-13 16:39:14 +00:00
Daniel Veillard
7933800926 Added new regression tests for #331062, daniel 2006-02-19 15:32:29 +00:00
Daniel Veillard
60faf528d8 fixed bug #307377 about validation of choices in list values. added
* relaxng.c: fixed bug #307377 about validation of choices in
  list values.
* test/relaxng/307377* result/relaxng/307377* Makefile.am runtest.c:
  added examples to the regression tests, problem is that streaming
  version gives slightly more informations.
Daniel
2005-08-10 16:23:57 +00:00
Daniel Veillard
336a8e13bf get rid of the dependancy on a locally installed DTD try to cleanup the
* test/relaxng/docbook_0.xml: get rid of the dependancy on a locally
  installed DTD
* uri.c include/libxml/uri.h xmlIO.c nanoftp.c nanohttp.c: try to
  cleanup the Path/URI conversion mess, needed fixing in various
  layers and a new API to the uri module which also fixes #306861
* runtest.c: integrated a regression test specific to check the
  URI conversions done before calling the I/O handlers.
Daniel
2005-08-07 10:46:19 +00:00
Daniel Veillard
cdc82737e2 added the missing entity to the document internal subset to avoid errors
* test/relaxng/docbook_0.xml: added the missing entity to the
  document internal subset to avoid errors if the DocBook catalogs
  are not there
* xmlschemas.c: first cut at implementing xmlSchemaValidateStream()
  untested yet
Daniel
2005-07-08 15:04:06 +00:00
Daniel Veillard
f46440392e fixed a bug exposed by Rob Richards in the mailing-list added the
* relaxng.c: fixed a bug exposed by Rob Richards in the mailing-list
* result//compare0* test//compare0*: added the regression test in
  the suite as this went unnoticed !
Daniel
2005-06-13 11:41:31 +00:00
Daniel Veillard
63d68a37be fixed a problem in Relax-NG validation #159968 added the test to the
* relaxng.c: fixed a problem in Relax-NG validation #159968
* test/relaxng/list.* result/relaxng/list_*: added the test
  to the regression suite
Daniel
2005-03-31 13:50:00 +00:00
Daniel Veillard
9186a1fdb6 fixed bug #157633 in relaxng choice optimization added regression tests
* relaxng.c: fixed bug #157633 in relaxng choice optimization
* result/relaxng/choice0* test/relaxng/choice0*: added regression
  tests about it.
* doc/*: rebuilt
* testdso.c: removed a warning due to a missing void in signature.
Daniel
2005-01-15 12:38:10 +00:00
William M. Brack
236c8c09f0 added check for external reference in xmlRelaxNGGetElements (bug 137718)
* relaxng.c: added check for external reference in
  xmlRelaxNGGetElements (bug 137718)
* test/relaxng/rngbug-001.*, result/relaxng/rngbug-001*: added
  regression test for above
2004-03-20 11:32:36 +00:00
Daniel Veillard
ce192eb8a6 more work on RelaxNG streaming validation trying to improve the subset
* relaxng.c xmllint.c: more work on RelaxNG streaming validation
  trying to improve the subset compiled, and more testing.
* doc/downloads.html doc/xml.html doc/xmlmem.html: some updates on the
  documentation
* test/relaxng/tutor11_1_3.xml: fixes the DTD path
* result/relaxng/*.err: fix some of the outputs
Daniel
2003-04-16 15:58:05 +00:00
Daniel Veillard
0e3d3ce267 fixed xmlRelaxNGNodeMatchesList augmented the test suite this fixes some
* relaxng.c: fixed xmlRelaxNGNodeMatchesList
* test/relaxng/testsuite.xml: augmented the test suite
* result/relaxng/spec1* result/relaxng/tutor12_1*: this fixes
  some schemas validation tests in the presence of foreign
  namespaces.
Daniel
2003-03-21 12:43:18 +00:00
Daniel Veillard
249d7bbee2 attempt to cope with ID/IDREF(S) declared both in the DTD and in the
* valid.c xmlschemastypes.c: attempt to cope with ID/IDREF(S)
  declared both in the DTD and in the Schemas <grin/>
* relaxng.c: more debug, added a big optimization for <mixed>
* test/relaxng/testsuite.xml: augmented the testsuite
* test/relaxng/ result/relaxng: added the RelaxNG spec and a
  DocBook example to the regression tests
Daniel
2003-03-19 21:02:29 +00:00
Daniel Veillard
a1a9d04100 removed a warning more cleanup, added ENTITY and ENTITIES support
* tree.c: removed a warning
* xmlschemastypes.c: more cleanup, added ENTITY and ENTITIES
  support
* check-relaxng-test-suite.py check-xsddata-test-suite.py:
  cleanup/improvements of the regression tests batch
* test/relaxng/testsuite.xml: augmented libxml2 own testsuite
Daniel
2003-03-18 16:53:17 +00:00
Daniel Veillard
c3da18a148 added Datatype ID and IDREF, usable from RelaxNG now need to add a new
* relaxng.c valid.c xmlschemastypes.c: added Datatype ID
  and IDREF, usable from RelaxNG now
* include/libxml/xmlschemastypes.h: need to add a new interface
  because the validation modifies the infoset
* test/relaxng/testsuite.xml: extended the testsuite
Daniel
2003-03-18 00:31:04 +00:00
Daniel Veillard
952379b780 fixed the last core RelaxNG bug known #107083, shemas datatype ID/IDREF
* relaxng.c: fixed the last core RelaxNG bug known #107083,
  shemas datatype ID/IDREF support still missing though.
* xmlreader.c: fix a crashing bug with prefix raised by
  Merijn Broeren
* test/relaxng/testsuite.xml: augmented the testsuite with
  complex inheritance tests
Daniel
2003-03-17 15:37:12 +00:00
Daniel Veillard
fd573f18a5 switched back to the previous Relax-NG code base, the derivation algorithm
* relaxng.c: switched back to the previous Relax-NG code base,
  the derivation algorithm need severe constraining code to avoid
  combinatorial explosion. Fixed the problem with Sebastian Rahtz
  TEI based example and other bugs
* result/relaxng/*err: updated the results
* test/relaxng/testsuite.xml: started a new test suite
Daniel
2003-03-16 17:52:32 +00:00
Daniel Veillard
5add868b2e stop generating wrong result file with * in name fixing the include bug
* Makefile.am: stop generating wrong result file with * in name
* relaxng.c: fixing the include bug raised by Sebastian Rahtz
* result/relaxng/demo* test/relaxng/demo: added the tests from
  Sebastian reproducing the problem.
Daniel
2003-03-10 13:13:58 +00:00
Daniel Veillard
1703c5fc23 OASIS RelaxNG testsuite python script to run regression against OASIS
* test/relaxng/OASIS/spectest.xml: OASIS RelaxNG testsuite
* check-relaxng-test-suite.py: python script to run regression
  against OASIS RelaxNG testsuite
* relaxng.c: some cleanup tweaks
* HTMLparser.c globals.c: cleanups in comments
* doc/libxml2-api.xml: updated the API
* result/relaxng/*: errors moved files, so large diffs but
  no changes at the semantic level.
Daniel
2003-02-10 14:28:44 +00:00
Daniel Veillard
231d791fc4 fixes a libtool problem on AMD 64bits builds found the validation problem
* libxml.spec.in: fixes a libtool problem on AMD 64bits builds
* relaxng.c: found the validation problem I had with interleave
  when not covering all remaining siblings
* Makefile.am test.relaxng/* result/relaxng/*: augmented the
  testsuite and check the RNG schemas against the RNG schemas
  given in appendix A
Daniel
2003-02-09 14:22:17 +00:00
Daniel Veillard
419a7688d0 more work on grammars and refs/defs augmented/updated the regression tests
* relaxng: more work on grammars and refs/defs
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-02-03 23:22:49 +00:00
Daniel Veillard
144fae1635 more work on name classes, except support augmented/updated the regression
* relaxng: more work on name classes, except support
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-02-03 13:17:57 +00:00
Daniel Veillard
1ed7f364bd more work on name classes, the "validate all" schemas seems to work now.
* relaxng: more work on name classes, the "validate all" schemas
  seems to work now.
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-02-03 10:57:45 +00:00
Daniel Veillard
fc1a4503fb check all the namespace support was actually correct based on tutorial
* test/relaxng/* result/relaxng/*: check all the namespace support
  was actually correct based on tutorial section 10.
Daniel
2003-02-02 16:02:55 +00:00
Daniel Veillard
e2a5a08b0f include seems to work okay now augmented/updated the regression tests
* relaxng: include seems to work okay now
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-02-02 14:35:17 +00:00
Daniel Veillard
a9d912de79 a bit of work done in the train back. added one of the include tests
* relaxng.c: a bit of work done in the train back.
* test/relaxng/*: added one of the include tests
Daniel
2003-02-01 17:43:10 +00:00
Daniel Veillard
80ec90acf1 More tests from section 9 of the tutorial, Daniel 2003-01-30 14:12:27 +00:00
Daniel Veillard
0fb0106547 Combine with interleave on attributes worked without chnages, daniel 2003-01-30 13:41:41 +00:00
Daniel Veillard
154877e554 more work done in the train augmented/updated the regression tests Daniel
* relaxng: more work done in the train
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-01-30 12:17:05 +00:00
Daniel Veillard
b711312c78 oops forgot two external rngs, Daniel 2003-01-30 05:49:40 +00:00
Daniel Veillard
e431a27d45 debugging of externalRef augmented/updated the regression tests Daniel
* relaxng.c: debugging of externalRef
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-01-29 23:02:33 +00:00
Daniel Veillard
d41f4f4888 more work on Relax-NG, implementing externalRef augmented/updated the
* relaxng.c: more work on Relax-NG, implementing externalRef
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
* Makefile.am: cleanup to Relaxtests target
Daniel
2003-01-29 21:07:52 +00:00
Daniel Veillard
b08c9815d2 more work on Relax-NG, implementing interleave augmented/updated the
* relaxng.c: more work on Relax-NG, implementing interleave
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-01-28 23:09:49 +00:00
Daniel Veillard
76fc5edab6 more work on Relax-NG, implementing interleave augmented/updated the
* relaxng.c: more work on Relax-NG, implementing interleave
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-01-28 20:58:15 +00:00
Daniel Veillard
c6e997c9a8 more work on Relax-NG augmented/updated the regression tests added a
* relaxng.c: more work on Relax-NG
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
* xmlschemastypes.c: added a number of base type definition but not
  the associated checks, those are still TODOs
Daniel
2003-01-27 12:35:42 +00:00
Daniel Veillard
ea3f398c39 more work on Relax-NG augmented/updated the regression tests Daniel
* relaxng.c: more work on Relax-NG
* test/relaxng/* result/relaxng/*: augmented/updated the
  regression tests
Daniel
2003-01-26 19:45:18 +00:00