summaryrefslogtreecommitdiff
path: root/test/errors
Commit message (Collapse)AuthorAgeFilesLines
* parser: Fix entity check in attributesNick Wellnhofer2023-01-171-0/+6
| | | | | | | | | Don't set the "checked" flag when checking entities in default attribute values. These entities could reference other entities which weren't defined yet, so the check isn't reliable. This fixes a short-lived regression which could lead to a call stack overflow later in xmlStringGetNodeList.
* error: Make sure that error messages are valid UTF-8Nick Wellnhofer2022-12-042-0/+2
| | | | | | This has caused issues with the Python bindings for a long time. Should fix #64.
* Only warn on invalid redeclarations of predefined entitiesNick Wellnhofer2022-02-201-0/+4
| | | | | | | | | | | | Downgrade the error message to a warning since the error was ignored, anyway. Also print the name of redeclared entity. For a proper fix that also shows filename and line number of the invalid redeclaration, we'd have to - pass the parser context to the entity functions somehow, or - make these functions return distinct error codes. Partial fix for #308.
* Fix double counting of CRLF in commentsNick Wellnhofer2022-02-071-0/+9
| | | | Fixes #151.
* Check for invalid redeclarations of predefined entitiesNick Wellnhofer2021-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add test case for recursive external parsed entitiesNick Wellnhofer2020-02-112-0/+5
|
* Remove executable bit from non-executable filesNick Wellnhofer2019-09-161-0/+0
|
* Revert "Print error messages for truncated UTF-8 sequences"v2.9.5-rc2Nick Wellnhofer2017-08-303-3/+0
| | | | | | | | | | This reverts commit 79c8a6b which caused a serious regression in streaming mode. Also reverts part of commit 52ceced "Fix infinite loops with push parser in recovery mode". Fixes bug 786554.
* Detect infinite recursion in parameter entitiesNick Wellnhofer2017-07-251-0/+11
| | | | | | | | | When expanding a parameter entity in a DTD, infinite recursion could lead to an infinite loop or memory exhaustion. Thanks to Wei Lei for the first of many reports. Fixes bug 759579.
* Rework entity boundary checksNick Wellnhofer2017-06-171-1/+4
| | | | | | | | | | | | | | | | Make sure to finish all entities in the internal subset. Nevertheless, readd a sanity check in xmlParseStartTag2 that was lost in my previous commit. Also add a sanity check in xmlPopInput. Popping an input unexpectedly was the source of many recent memory bugs. The check doesn't mitigate such issues but helps with diagnosis. Always base entity boundary checks on the input ID, not the input pointer. The pointer could have been reallocated to the old address. Always throw a well-formedness error if a boundary check fails. In a few places, a validity error was thrown. Fix a few error codes and improve indentation.
* Print error messages for truncated UTF-8 sequencesNick Wellnhofer2017-06-103-0/+3
| | | | | | | | Before, truncated UTF-8 sequences at the end of a file were treated as EOF. Create an error message containing the offending bytes. xmlStringCurrentChar would also print characters from the input stream, not the string it's working on.
* Heap-based buffer-underreads due to xmlParseNameDavid Kilzer2016-05-232-0/+10
| | | | | | | | | | | | | | | | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=759573 * parser.c: (xmlParseElementDecl): Return early on invalid input to fix non-minimized test case (759573-2.xml). Otherwise the parser gets into a bad state in SKIP(3) at the end of the function. (xmlParseConditionalSections): Halt parsing when hitting invalid input that would otherwise caused xmlParserHandlePEReference() to recurse unexpectedly. This fixes the minimized test case (759573.xml). * result/errors/759573-2.xml: Add. * result/errors/759573-2.xml.err: Add. * result/errors/759573-2.xml.str: Add. * result/errors/759573.xml: Add. * result/errors/759573.xml.err: Add. * result/errors/759573.xml.str: Add. * test/errors/759573-2.xml: Add. * test/errors/759573.xml: Add.
* Heap use-after-free in xmlSAX2AttributeNsCVE-2016-1835Pranjal Jumde2016-05-231-0/+46
| | | | | | | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=759020 * parser.c: (xmlParseStartTag2): Attribute strings are only valid if the base does not change, so add another check where the base may change. Make sure to set 'attvalue' to NULL after freeing it. * result/errors/759020.xml: Added. * result/errors/759020.xml.err: Added. * result/errors/759020.xml.str: Added. * test/errors/759020.xml: Added test case.
* Bug 759398: Heap use-after-free in xmlDictComputeFastKey ↵CVE-2016-1836Pranjal Jumde2016-05-231-0/+326
| | | | | | | | | | | | | <https://bugzilla.gnome.org/show_bug.cgi?id=759398> * parser.c: (xmlParseNCNameComplex): Store start position instead of a pointer to the name since the underlying buffer may change, resulting in a stale pointer being used. * result/errors/759398.xml: Added. * result/errors/759398.xml.err: Added. * result/errors/759398.xml.str: Added. * test/errors/759398.xml: Added test case.
* Bug 758588: Heap-based buffer overread in xmlParserPrintFileContextInternal ↵CVE-2016-1838David Kilzer2016-05-231-0/+1
| | | | | | | | | | | | | | <https://bugzilla.gnome.org/show_bug.cgi?id=758588> * parser.c: (xmlParseEndTag2): Add bounds checks before dereferencing ctxt->input->cur past the end of the buffer, or incrementing the pointer past the end of the buffer. * result/errors/758588.xml: Add test result. * result/errors/758588.xml.err: Ditto. * result/errors/758588.xml.str: Ditto. * test/errors/758588.xml: Add regression test.
* Fix a bug in CData error handling in the push parserDaniel Veillard2015-09-181-0/+1
| | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=754947 The checking function was returning incorrect args in some cases Adds the test to teh reg suite and fix one of the existing test output
* Fix a bug on name parsing at the end of current input bufferDaniel Veillard2015-09-151-0/+1
| | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=754946 When hitting the end of the current input buffer while parsing a name we could end up loosing the beginning of the name, which led to various issues.
* Do not fetch external parsed entitiesDaniel Veillard2012-07-231-0/+5
| | | | | | | | | Unless explicietely asked for when validating or replacing entities with their value. Problem pointed out by Tom Lane <tgl@redhat.com> * parser.c: do not load external parsed entities unless needed * test/errors/extparsedent.xml result/errors/extparsedent.xml*: add a regression test to avoid change of the behaviour in the future
* rewrite the URI parser to update to rfc3986 (from 2396) removed the errorDaniel Veillard2008-08-041-9/+0
| | | | | | | | | | | * uri.c include/libxml/uri.h: rewrite the URI parser to update to rfc3986 (from 2396) * test/errors/webdav.xml result/errors/webdav.xml*: removed the error test, 'DAV:' is a correct URI under 3986 * Makefile.am: small cleanup in make check Daniel svn path=/trunk/; revision=3763
* fix a memeory leak in internal subset parsing with a fix from Ashwin addDaniel Veillard2008-01-241-0/+10
| | | | | | | | | | * parser.c: fix a memeory leak in internal subset parsing with a fix from Ashwin * test/errors/content1.xml result/errors/content1.xml*: add test to regressions Daniel svn path=/trunk/; revision=3680
* fixed a parser bug where invalid char in comment may not be detected,Daniel Veillard2007-08-011-0/+6
| | | | | | | | | | * parser.c: fixed a parser bug where invalid char in comment may not be detected, reported by Ashwin Sinha * test/errors/comment1.xml result/errors/comment1.xml*: added the example to the regression suite Daniel svn path=/trunk/; revision=3647
* fix bug #414846 where invalid characters in attributes would sometimes notDaniel Veillard2007-06-121-0/+1
| | | | | | | | | | * parser.c: fix bug #414846 where invalid characters in attributes would sometimes not be detected. * test/errors/attr4.xml result/errors/attr4.xml*: added a specific test case to the regression tests Daniel svn path=/trunk/; revision=3634
* fixed problem with free on dupl attribute in dtd (bug309637). addedWilliam M. Brack2005-07-061-0/+6
| | | | | | | * parser.c: fixed problem with free on dupl attribute in dtd (bug309637). * test/errors/attr3.xml, result/errors/attr3.*: added regression test for this
* fixed a bug failing to detect UTF-8 violations in CData in push mode.Daniel Veillard2005-07-041-0/+2
| | | | | | | | * parser.c: fixed a bug failing to detect UTF-8 violations in CData in push mode. * result/errors/cdata.xml* test/errors/cdata.xml: added the test to the regressions Daniel
* fixed bug #164556 where non-fatal errors stopped push parsing andDaniel Veillard2005-01-211-0/+9
| | | | | | | | | * parser.c: fixed bug #164556 where non-fatal errors stopped push parsing and xmlreader. * Makefile.am: fixup * test/errors/webdav.xml result/errors/webdav*: adding regression test for this problem. Daniel
* fixed a bug where invalid charrefs may not be detected sometimes asDaniel Veillard2004-06-031-0/+1
| | | | | | | | * parser.c: fixed a bug where invalid charrefs may not be detected sometimes as pointed by Morus Walter. * test/errors/charref1.xm result/errors/charref1.xml*: added the test in the regression suite. Daniel
* Beuah ! DanielDaniel Veillard2004-02-214-0/+4
| | | | | Beuah ! Daniel
* Huge commit: 1.5.0, XML validation, Xpath, bugfixes, examples .... DanielDaniel Veillard1999-08-101-0/+6