kc3-lang/libxml2/valid.c

Branch :


Log

Author Commit Date CI Message
0c56eb82 2024-08-12 21:38:50 tree: Restore return value of xmlNodeListGetString with NULL list When passing a NULL list to xmlNodeListGetString or xmlNodeListGetRawString, return NULL instead of "" to match the old behavior. Fixes #783.
6be79014 2024-07-15 14:18:26 Remove unused code
842a0448 2024-07-03 11:46:06 valid: Restore ID lookup Revert a change from d025cfbb and don't overwrite ID table entries, so that the first attribute will be returned if there are duplicate IDs. This requires two other changes: - Attributes in entity content are never added to the ID table. This seems reasonable. - Remove the optimization to skip ID lookup when copying and the target document has an empty ID table. This also seems more correct since the document could have ID declarations nevertheless or we could be copying xml:ids into the document for the first time. Fixes #757.
2def7b4b 2024-06-18 13:55:34 clang-tidy: move assignments out of if Found with bugprone-assignment-in-if-condition Signed-off-by: Rosen Penev <rosenp@gmail.com>
217e9b7a 2024-06-08 12:27:45 clang-tidy: don't return in void functions Found with readability-redundant-control-flow Signed-off-by: Rosen Penev <rosenp@gmail.com>
1b640358 2024-06-16 00:39:39 schemas: Stop using xmlValidateNotationUse Simplify symbol availability logic.
b0fc67aa 2024-06-15 22:53:55 build: Remove --with-tree configuration option This option would allow for a smaller, but mostly useless minimal build. But it complicates the symbol availability logic in an insane way and requires specialized tools like our custom C parser in doc/apibuild.py. See #717.
11cd18d8 2024-05-31 13:31:09 valid: Check return value of xmlValidBuildAContentModel Fixes return code in case of malloc failure.
e75e878e 2024-05-20 13:58:22 doc: Update and fix documentation
0651ad66 2024-05-05 20:20:22 valid: Report malloc failure after xmlRegExecPushString
9bce9dbb 2024-03-26 14:30:57 valid: Report malloc failure in xmlValidateOneElement
577e2516 2024-03-19 17:06:07 valid: Check for NULL node->name in xmlSnprintfElements Unfortunately, we can have NULL element names if xmlSetTreeDoc fails.
dc2a03d4 2024-03-16 14:50:56 valid: Deprecate internal validation functions
291a9d0f 2024-03-08 18:45:24 valid: Set document on dummmy element declaration
9033a270 2024-03-05 16:45:44 malloc-fail: Stop using xmlSplitQName2 This function doesn't report malloc failures.
b38f8eae 2024-03-05 14:55:15 malloc-fail: Report in xmlAddAttributeDecl
3061b56a 2024-03-15 02:23:08 valid: Check for NULL text content in xmlValidateOneElement Shouldn't occur in parsed documents but you can create text nodes with NULL content through the API.
af3d80b9 2024-03-14 20:49:39 valid: Check for elem->name in xmlIsID elem->name can be NULL is xmlNodeSetDoc failed.
1233805d 2024-03-06 15:49:20 valid: Fix some return codes after errors
04c691f7 2024-03-05 19:59:42 valid: Eliminate xmlCtxtGetDtdElementDesc Improves malloca failure reporting without parser context.
ab345338 2024-03-05 19:58:17 valid: Report malloc failure in legacy DTD serialization
264b283c 2024-03-05 14:55:42 valid: Fix hash removal in xmlRemoveRef Don't create a NULL entry.
802ad903 2024-03-05 14:54:16 valid: Don't report errors with null context
f797cdab 2024-03-02 18:59:16 valid: Remove id before updating attribute type
a3e11e3d 2024-03-01 15:55:35 valid: Fix id handling in xmlValidateDtd Free id table before and after validation.
c4e0db6a 2024-03-02 16:02:39 valid: Reset attribute in xmlFreeID
bbbd7f77 2024-03-01 14:27:08 valid: Rework checks in xmlValidateOneElement Don't check element for extra members and missing content. Consolidate checks for unexpected elements.
b23175d1 2024-02-29 19:57:28 valid: Check element type in xmlIsID Also rearrange code for readability.
0ddd63db 2024-02-29 16:40:26 valid: Change error code to XML_ERR_ARGUMENT
d0d6174e 2024-02-29 19:38:29 valid: Rework xmlAddID
9835ec2b 2024-02-13 10:58:19 valid: Fix xmlAddIDSafe in "streaming" mode Make sure that IDs and attributes never reference each other in streaming (XML reader) mode, even when attributes are copied from an entity. Also update lineno. Fixes a short-lived use-after-free.
2807df9a 2024-02-06 12:07:19 valid: Fix another use-after-free in xmlAddIDSafe Short-lived regression.
70da4c08 2024-02-04 13:30:32 valid: Fix use-after-free in xmlAddIDSafe Short-lived regression.
cf875194 2024-02-01 19:26:42 valid: Deprecate old DTD serialization API
fbe10a46 2024-02-01 19:01:57 save: Move DTD serialization code to xmlsave.c
661ef936 2024-01-02 18:50:59 valid: Fix some error codes
d025cfbb 2023-12-27 03:53:24 parser: Always copy content from entity to target. Make sure that references from IDs are updated. Note that if there are IDs with the same value in a document, the last one will now be returned. IDs should be unique, but maybe this should be addressed.
13043691 2023-12-20 00:33:34 parser: Rename xmlErrParser to xmlCtxtErr
54c70ed5 2023-12-18 19:31:29 parser: Improve error handling Introduce xmlCtxtSetErrorHandler allowing to set a structured error for a parser context. There already was the "serror" SAX handler but this always receives the parser context as argument. Start to use xmlRaiseMemoryError. Remove useless arguments from memory error functions. Rename xmlErrMemory to xmlCtxtErrMemory. Remove a few calls to xmlGenericError. Remove support for runtime entity debugging.
355fbe3a 2023-12-16 15:02:43 valid: Fix handling of enumerations Make xmlFreeEnumeration, xmlCopyEnumeration and xmlDumpEnumeration non-recursive. Report malloc failure in xmlCopyEnumeration.
61b4c42f 2023-12-10 18:27:42 valid: Report malloc failures Fix many places where malloc failures aren't reported.
e34a49b7 2023-12-10 16:29:31 valid: Improve addition and deletion of IDs Introduce a new API function xmlAddIDSafe that returns a separate error code if a memory allocation fails. Store a pointer to the ID struct in xmlAttr so attributes can be freed without allocating memory. It's impossible to report malloc failures in deallocation code.
8c084ebd 2023-09-21 22:57:33 doc: Make apibuild.py happy
699299ca 2023-09-20 18:54:39 globals: Stop including globals.h
4e1c13eb 2023-09-18 14:45:10 debug: Remove debugging code This is barely useful these days and only clutters the code base.
58de9d31 2023-08-03 12:00:55 valid: Fix c1->parent pointer in xmlCopyDocElementContent Fixes #572.
cb1b8b85 2023-04-10 13:06:18 xmlValidatePopElement() can return invalid value (-1) Covered by: test/VC/ElementValid5 This only affects XML Reader API with LIBXML_REGEXP_ENABLED and LIBXML_VALID_ENABLED turned on. * result/VC/ElementValid5.rdr: - Update result to add missing error message. * python/tests/reader2.py: * result/VC/ElementValid6.rdr: * result/VC/ElementValid7.rdr: * result/valid/781333.xml.err.rdr: - Update result to fix grammar issue. * valid.c: (xmlValidatePopElement): - Check return value of xmlRegExecPushString() to handle -1, and assign 'ret = 0;' to return 0 from xmlValidatePopElement(). This change affects xmlTextReaderValidatePop() from xmlreader.c. - Fix grammar of error message by changing 'child' to 'children'.
08f9d319 2023-03-16 17:01:05 valid: Make xmlValidateElement non-recursive Fixes call stack overflows when validating deeply nested documents. Found by OSS-Fuzz.
a57a7549 2023-03-12 16:06:19 valid: Allow xmlFreeValidCtxt(NULL)
9fa1b228 2023-02-14 16:43:35 malloc-fail: Fix memory leak in xmlGetDtdElementDesc2 Found with libFuzzer, see #344.
dd3569ea 2022-12-08 02:43:17 Remove XMLDECL macro from .c files
4b959ee1 2022-12-01 13:23:09 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.
c7149792 2022-09-01 23:15:35 Fix --with-valid --without-regexps build This build config resulted in segfaults in 'runtest' because a special xmlElementContentPtr showed up in a few places. I'm not sure if this is the right fix. An error message was changed to conform to the --with-regexps build. There are still a few missing validity errors, so the tests don't pass.
ad338ca7 2022-09-01 01:18:30 Remove explicit integer casts Remove explicit integer casts as final operation - in assignments - when passing arguments - when returning values Remove casts - to the same type - from certain range-bound values The main motivation is that these explicit casts don't change the result of operations and only render UBSan's implicit-conversion checks useless. Removing these casts allows UBSan to detect cases where truncation or sign-changes occur unexpectedly. Document some explicit casts as truncating and add a few missing ones.
0f568c0b 2022-08-26 01:22:33 Consolidate private header files Private functions were previously declared - in header files in the root directory - in public headers guarded with IN_LIBXML - in libxml.h - redundantly in source files that used them. Consolidate all private header files in include/private.
b7e8e4c7 2022-04-06 18:05:20 Fix leak of xmlElementContent * valid.c: (xmlCopyDocElementContent): - Set `tmp->parent` properly to fix a leak that occurs in xmlFreeDocElementContent(). - Appears to be a regresion from cee2b3a5f1. Found by OSS-Fuzz Issue 44509.
4a8c71eb 2022-03-04 03:35:57 Remove DOCBparser This code has been broken and deprecated since version 2.6.0, released in 2003. Because of a bug in commit 961b535c, DOCBparser.c was never compiled since 2012. I couldn't find a Debian package using any of its symbols, so it seems safe to remove this module.
776d15d3 2022-03-02 00:29:17 Don't check for standard C89 headers Don't check for - ctype.h - errno.h - float.h - limits.h - math.h - signal.h - stdarg.h - stdlib.h - string.h - time.h Stop including non-standard headers - malloc.h - strings.h
d05317ce 2022-02-22 11:51:08 Fix --without-valid build Regressed in commit 652dd12a.
004fe9de 2022-02-20 19:02:31 Deprecate IDREF-related functions in valid.h These functions are only needed internally for validation. xmlGetRefs is inherently unsafe because the ref table isn't updated if attributes are removed (unlike the ids table). None of the Ubuntu 20.04 packages depending on libxml2 use any of these functions (except xmlFreeRefTable in libxslt), so it seems perfectly safe to deprecate them. Remove xmlIsRef and xmlRemoveRef from the Python bindings.
346c3a93 2022-02-20 18:46:42 Remove elfgcchack.h The same optimization can be enabled with -fno-semantic-interposition since GCC 5. clang has always used this option by default.
d7cb33cf 2022-01-13 17:06:14 Rework validation context flags Use a bitmask instead of magic values to - keep track whether the validation context is part of a parser context - keep track whether xmlValidateDtdFinal was called This allows to add addtional flags later. Note that this deliberately changes the name of a public struct member, assuming that this was always private data never to be used by client code.
652dd12a 2022-02-08 03:29:24 [CVE-2022-23308] Use-after-free of ID and IDREF attributes If a document is parsed with XML_PARSE_DTDVALID and without XML_PARSE_NOENT, the value of ID attributes has to be normalized after potentially expanding entities in xmlRemoveID. Otherwise, later calls to xmlGetID can return a pointer to previously freed memory. ID attributes which are empty or contain only whitespace after entity expansion are affected in a similar way. This is fixed by not storing such attributes in the ID table. The test to detect streaming mode when validating against a DTD was broken. In connection with the defects above, this could result in a use-after-free when using the xmlReader interface with validation. Fix detection of streaming mode to avoid similar issues. (This changes the expected result of a test case. But as far as I can tell, using the XML reader with XIncludes referencing the root document never worked properly, anyway.) All of these issues can result in denial of service. Using xmlReader with validation could result in disclosure of memory via the error channel, typically stderr. The security impact of xmlGetID returning a pointer to freed memory depends on the application. The typical use case of calling xmlGetID on an unmodified document is not affected.
20c60886 2020-03-08 17:19:42 Fix typos Resolves #133.
9bd7abfb 2020-01-02 14:14:48 Remove useless comparisons Found by lgtm.com
aec2bf71 2019-10-14 18:01:51 Make xmlFreeDocElementContent non-recursive Avoid call stack overflow when freeing element type declarations with deeply nested contents. Found by OSS-Fuzz.
24e3973b 2019-10-04 14:42:59 Make xmlDumpElementContent non-recursive Avoid call stack overflow when dumping deeply nested element declarations. Found by OSS-Fuzz.
2a350ee9 2019-09-30 17:04:54 Large batch of typo fixes Closes #109.
4dd6d7a5 2017-11-09 17:28:00 Fix list callback signatures Make sure that all parameters and return values of list 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. Also change the `user` parameter type from `const void *` to `void *`.
e03f0a19 2017-11-09 16:42:47 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.
d2c329a9 2017-10-21 13:49:31 Fix -Wimplicit-fallthrough warnings Add "falls through" comments to quench implicit-fallthrough warnings which are enabled by -Wextra under GCC 7.
c709f3f2 2017-09-07 19:52:39 Fix structured validation errors Also pass 'str2'. Fixes bug 777473.
8bbe4508 2017-06-17 16:15:09 Spelling and grammar fixes Fixes bug 743172, bug 743489, bug 769632, bug 782400 and a few other misspellings.
92b9e8c8 2017-06-06 12:56:28 Fix type confusion in xmlValidateOneNamespace Comment out code that casts xmlNsPtr to xmlAttrPtr. ID types on namespace declarations make no practical sense anyway. Fixes bug 780228. Found with libFuzzer and ASan.
94691dc8 2017-06-07 16:47:36 Fix NULL pointer deref in xmlDumpElementContent Can only be triggered in recovery mode. Fixes bug 758422 (CVE-2017-5969).
932cc989 2017-06-03 02:01:29 Fix buffer size checks in xmlSnprintfElementContent xmlSnprintfElementContent failed to correctly check the available buffer space in two locations. Fixes bug 781333 (CVE-2017-9047) and bug 781701 (CVE-2017-9048). Thanks to Marcel Böhme and Thuan Pham for the report.
4472c3a5 2016-05-13 15:13:17 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.
bb654feb 2016-04-13 16:56:07 Fix typos: dictio{ nn -> n }ar{y,ies} Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
ef709ce2 2015-09-10 19:41:41 Fix the spurious ID already defined error For https://bugzilla.gnome.org/show_bug.cgi?id=737840 the fix for 724903 introduced a regression on external entities carrying IDs, revert that patch in part and add a specific test to avoid readding it
658b86c0 2014-08-07 11:19:03 Couple of Missing Null checks For https://bugzilla.gnome.org/show_bug.cgi?id=734328 Missing Null check could cause crash, if a pointer is dereferenced. Found problem at two places in valid.c
a16eb968 2014-06-10 16:06:14 erroneously ignores a validation error if no error callback set Reported by Stefan Behnel https://bugzilla.gnome.org/show_bug.cgi?id=724903
e18bce0d 2014-02-06 10:47:20 fixing a ptotential uninitialized access
01461791 2013-08-06 09:55:55 Drop not needed checks https://bugzilla.gnome.org/show_bug.cgi?id=704075
c570b379 2013-09-30 10:43:47 Fix pointer dereferenced before null check for https://bugzilla.gnome.org/show_bug.cgi?id=708364 xmlValidateElementContent is a private function but should still check the ctxt argument before dereferencing
fb27e2cd 2012-09-28 08:59:33 Fix spelling of "length".
f8e3db04 2012-09-11 13:26:36 Big space and tab cleanup Remove all space before tabs and space and tabs at end of lines.
3e62adbe 2012-08-09 14:24:02 Adding various checks on node type though the API Specifially checking against namespace nodes before accessing node pointers
cb3549e3 2011-11-11 11:25:07 Improve the error report on undefined REFs Use the tree node to provide the error context instead of the parser input which is not relevant anymore, based on a suggestion by François Delyon <f.delyon@satimage.fr>
f3c06692 2009-10-16 16:47:58 Recognize ID attribute in HTML without DOCTYPE * valid.c: xmlIsID() was short-circuiting the case where there was no DTD.
594e5dfb 2009-09-07 14:58:47 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)
a721612e 2009-08-21 18:22:58 446613 small validation bug mixed content with NS * valid.c: fix a bug when valdating mixed content lists and some name use namespaces prefixes. * result/valid/notes.xml* test/valid/dtds/notes.dtd * test/valid/notes.xml: add the test case to the regression suite
8ed1072c 2009-08-20 19:17:36 Add symbol versioning to libxml2 shared libs * libxml2.syms: the symbols with history, going back to 2.4.30 * Makefile.am configure.in: linking flags detection and use * parser.c tree.c valid.c xpointer.c: various cleanup of functions which could be made static or simply discarded, not that many
eab3ac94 2009-08-12 10:39:29 567619 xmlValidateNotationUse missing param test * valid.c: this was raised by a testapi crash on solaris
bccae2d2 2009-06-04 11:22:45 * c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string patch by Christian Persch, fixes #581612
be2bd6ac 2008-11-27 15:26:28 adds element traversal support avoid a warning regenerated daniel * include/libxml/tree.h tree.c python/generator.py: adds element traversal support * valid.c: avoid a warning * doc/*: regenerated daniel svn path=/trunk/; revision=3804
2cba4158 2008-08-27 11:45:41 fix a small initialization problem raised by Ashwin increase testing * threads.c: fix a small initialization problem raised by Ashwin * testapi.c gentest.py: increase testing especially for document with an internal subset, and entities * tree.c: fix a deallocation issue when unlinking entities from a document. * valid.c: fix a missing entry point test not found previously. * doc/*: regenerated the APIs, docs etc. daniel svn path=/trunk/; revision=3778
ae0765b6 2008-07-31 19:54:59 more progresses against the official regression tests small cleanup for * runxmlconf.c: more progresses against the official regression tests * runsuite.c: small cleanup for non-leak reports * include/libxml/tree.h: parsing flags and other properties are now added to the document node, this is generally useful and allow to make Name and NmToken validations based on the parser flags, more specifically the 5th edition of XML or not * HTMLparser.c tree.c: small side effects for the previous changes * parser.c SAX2.c valid.c: the bulk of teh changes are here, the parser and validation behaviour can be affected, parsing flags need to be copied, lot of changes. Also fixing various validation problems in the regression tests. Daniel svn path=/trunk/; revision=3762
38431c33 2007-06-12 16:20:09 release of libxml2 2.6.28 patch from Dagfinn I. Mannsåker for idness of * doc/* configure.in NEWS: release of libxml2 2.6.28 * valid.c: patch from Dagfinn I. Mannsåker for idness of name in HTML, c.f. bug #305885. Daniel svn path=/trunk/; revision=3638
f6cf57a0 2007-05-09 23:53:30 applied patch to fix xmlListAppend() from Georges-André SILBER also fix * list.c: applied patch to fix xmlListAppend() from Georges-André SILBER * valid.c: also fix the place wher it was called. Daniel svn path=/trunk/; revision=3614
6ad5c4af 2006-10-11 16:43:06 fixed a weird error where validity context whould not show up if warnings * valid.c: fixed a weird error where validity context whould not show up if warnings were disabled pointed out by Bob Stayton * xmlIO.c doc/generator.py: cleanup and fix to regenerate the docs * doc//* testapi.c: rebuilt the docs Daniel