1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-27 04:55:04 +03:00
Commit Graph

173 Commits

Author SHA1 Message Date
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
09b6f8183d Fix potential null deref in xmlRelaxNGParsePatterns
Thanks to Zhongyuan Zhou for the initial patch.
2019-08-25 14:12:34 +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
Nick Wellnhofer
6348496230 Remove redundant code in xmlRelaxNGValidateState
Closes #70.
2019-07-08 12:28:39 +02:00
Nikolai Weibull
7c4949afab Fix "Problem with data in interleave in RelaxNG validation"
Fixes commit c8e5f958.

https://mail.gnome.org/archives/xml/2018-November/msg00029.html
2019-01-01 20:02:36 +01: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
Nikolai Weibull
c8e5f9588b Problem with data in interleave in RelaxNG validation
Reported in https://mail.gnome.org/archives/xml/2018-October/msg00003.html

The issue seems to be that we build groups of what can be matched by
the interleave, but that these groups don’t include data, list,
and value elements, only element and text elements.  This patch
extends xmlRelaxNGGetElements so that it can return these elements
for us in xmlRelaxNGComputeInterleaves.  Then we make sure to
updatexmlRelaxNGNodeMatchesList as well so that it accepts the correct
types.
2018-11-22 18:14:47 +01:00
Nick Wellnhofer
e03f0a199a Fix hash callback signatures
Make sure that all parameters and return values of hash callback
functions exactly match the callback function type. This is required
to pass clang's Control Flow Integrity checks and to allow compilation
to asm.js with Emscripten.

Fixes bug 784861.
2017-11-09 16:42:47 +01:00
J. Peter Mugaas
d2c329a9a4 Fix -Wimplicit-fallthrough warnings
Add "falls through" comments to quench implicit-fallthrough warnings
which are enabled by -Wextra under GCC 7.
2017-10-21 13:49:31 +02:00
Nick Wellnhofer
d422b954be Fix pointer/int cast warnings on 64-bit Windows
On 64-bit Windows, `long` is 32 bits wide and can't hold a pointer.
Switch to ptrdiff_t instead which should be the same size as a pointer
on every somewhat sane platform without requiring C99 types like
intptr_t.

Fixes bug 788312.

Thanks to J. Peter Mugaas for the report and initial patch.
2017-10-09 13:47:49 +02:00
Chun-wei Fan
d77e5fc4bc relaxng.c, xmlschemas.c: Fix build on pre-C99 compilers
Make sure that the variables are declared at the top of the block.

https://bugzilla.gnome.org/show_bug.cgi?id=767063
2016-06-23 19:02:26 +08:00
David Kilzer
502f6a6d08 More format string warnings with possible format string vulnerability
For https://bugzilla.gnome.org/show_bug.cgi?id=761029

adds a new xmlEscapeFormatString() function to escape composed format
strings
2016-05-23 15:01:08 +08:00
David Kilzer
4472c3a5a5 Fix some format string warnings with possible format string vulnerability
For https://bugzilla.gnome.org/show_bug.cgi?id=761029

Decorate every method in libxml2 with the appropriate
LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups
following the reports.
2016-05-23 15:01:07 +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
Philip Withnall
579410427f Remove various unused value assignments
As detected by Coverity (CIDs 60467–60472).

https://bugzilla.gnome.org/show_bug.cgi?id=739220
2014-10-27 21:18:57 +08:00
Daniel Veillard
42870f46cc Add couple of missing Null checks
For https://bugzilla.gnome.org/show_bug.cgi?id=733710
Reported by Gaurav but with slightly different fixes
2014-07-26 21:04:54 +08:00
Gaurav Gupta
54c4b1aa71 Add a couple of misisng check in xmlRelaxNGCleanupTree
For https://bugzilla.gnome.org/show_bug.cgi?id=733041

check cur->parent before dereferencing the pointer even if
a null parent there should not happen
Also fix a typo
2014-07-14 16:14:44 +08:00
Gaurav Gupta
7d2e8c950f Add a missing argument check
For https://bugzilla.gnome.org/show_bug.cgi?id=733042

the states argument of xmlRelaxNGAddStates() ought to be checked too
2014-07-14 16:08:28 +08:00
Gaurav Gupta
6d753994b9 Adding a check in case of allocation error
For https://bugzilla.gnome.org/show_bug.cgi?id=733043

There is missing Null condition in xmlRelaxNGValidateInterleave of
relaxng.c
Dereferencing it may cause a crash.
2014-07-14 16:01:10 +08:00
Jan Pokorný
acace88c4a Fix typos in relaxng.c
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2014-06-10 14:41:06 +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
Gaurav
7d4e259fbf Avoid some dead code and cleanup in relaxng.c
https://bugzilla.gnome.org/show_bug.cgi?id=705388

Code needed a bit of cleanup
2013-09-30 11:27:41 +08:00
Michael Wood
fb27e2cd20 Fix spelling of "length". 2012-10-30 10:18:49 +08:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +08:00
Daniel Veillard
264cee695a Add a missing element check 2012-08-13 12:40:53 +08:00
Noam
9313ae8517 Fix weird streaming RelaxNG errors
For https://bugzilla.gnome.org/show_bug.cgi?id=512454
The bug was to use compiled determinitic automata when
the content model was found to be non-deterministic, leading
to random parsing errors.
2012-05-15 11:03:46 +08:00
Daniel Veillard
7dd0d916c6 Fix an unimplemented part in RNG value validation
Forgot to implement <optional> this was raised again
in https://bugzilla.redhat.com/show_bug.cgi?id=752393
as this make libxml2 fail to validate against ODF RNGs

Daniel
2011-11-10 18:08:33 +08:00
Shaun McCance
d7eb9b5d47 Fix RELAX NG include bug #655288
When overriding during include, children of the root
node are scanned. But the root node was gotten with
doc->children, instead of xmlDocGetRootElement.
2011-08-04 10:28:59 -04:00
Ben Walton
a7a6a4b2f3 relaxng.c: cast to allow compilation with sun studio 11
Sun Studio 11 was failing to compile relaxng.c due to a type mismatch
in a ternary operator used to provide an argument to xmlRngPErr.  It
seems that sos11 cc is more pedantic about this part of the C99
standard.  GCC issues a warning but doesn't fail by default.

After casting the string literal "nothing" to (const xmlChar *) sos11
cc is happy.  GCC no longer issues a warning either.

Another warning was cleaned up with an identical cast.
2010-03-15 10:06:36 +01: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
Rob Richards
848e5cf3ab Fix Windows build
* relaxng.c: fix windows build
2009-09-09 12:13:58 -04:00
Daniel Veillard
594e5dfb48 Chasing dead assignments reported by clang-scan
* SAX2.c dict.c error.c hash.c nanohttp.c parser.c python/libxml.c
  relaxng.c runtest.c tree.c valid.c xinclude.c xmlregexp.c xmlsave.c
  xmlschemas.c xpath.c xpointer.c: mostly removing unneded affectations,
  but this led to a few real bugs and some part not yet understood
  (relaxng/interleave)
2009-09-07 14:58:47 +02:00
Daniel Veillard
d44b936499 A few more safety cleanup raised by scan
* SAX2.c encoding.c parser.c xmlschemas.c: a few more safety checks
* relaxng.c: remove an unused intitialization
2009-09-07 12:15:08 +02:00
Daniel Veillard
76d364583e Fixing assorted potential problems raised by scan
* encoding.c parser.c relaxng.c runsuite.c tree.c xmlreader.c
  xmlschemas.c: nothing really serious but better safe than sorry
2009-09-07 11:19:33 +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
fd78077281 558452 RNG compilation of optional multiple child
* relaxng.c: don't assume there is a single define under a optional
2009-08-26 18:35:29 +02:00
Daniel Veillard
a4f27cb649 Fix the problem of revalidating a doc with RNG
* relaxng.c: simply clear up the ->psvi of elements on the tree upon
  return, should not be needed for streaming APIs as tree are discarded
2009-08-21 17:34:17 +02:00
Daniel Veillard
81c51e174d 512131 refs from externalRef part need to be added
* relaxng.c: refs from externalRef subschemas need to be added to
  the main schemas. Also fix a couple of problems with dangling
  references
2009-08-14 18:52:10 +02:00
Daniel Veillard
9fcd462f27 512131 crash in xmlRelaxNGValidateFullElement
* relaxng.c: in some case we were not freeing the right data, also
  cleanup a few other things
2009-08-14 16:16:31 +02:00
Daniel Veillard
23a47d6048 Switch off debugging, oops, Daniel
svn path=/trunk/; revision=3749
2008-06-25 04:11:24 +00:00
Daniel Veillard
25a1ce9134 patch from Hans de Goede to switch the file to UTF-8 switch to generate
* ChangeLog: patch from Hans de Goede to switch the file to UTF-8
* doc/news.xsl: switch to generate the NEWS file in UTF-8 instead of
  ISO-8859-1
Daniel

svn path=/trunk/; revision=3745
2008-06-02 16:04:12 +00:00
Daniel Veillard
d8ed1051fa fixed bug #407436 a crash in a specific case of Relax-NG validation Daniel
* relaxng.c: fixed bug #407436 a crash in a specific case of
  Relax-NG validation
Daniel

svn path=/trunk/; revision=3629
2007-06-12 09:24:46 +00:00
Daniel Veillard
fa0d094ae3 fix a Relax-NG bug related to element content processing, fixes bug
* relaxng.c: fix a Relax-NG bug related to element content processing,
  fixes bug #302836
Daniel
2006-10-13 16:30:56 +00:00
William M. Brack
700f987fff Fixed compilation error (bug 340765) reported by dmacks with patch
* relaxng.c: Fixed compilation error (bug 340765) reported by
  dmacks with patch supplied by Graham Bennett.
2006-05-06 03:16:22 +00:00
Daniel Veillard
b2f8f1de7a preparing 2.6.24 release, fixed Python paths at the last moment fix some
* NEWS configure.in doc//*: preparing 2.6.24 release, fixed Python
  paths at the last moment
* relaxng.c testapi.c tree.c: fix some comments
Daniel
2006-04-28 16:30:48 +00:00