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

4358 Commits

Author SHA1 Message Date
Patrick Monnerat
22b0415a89 os400: fix various ILE/RPG types definitions. Adjust build scripts.
- A typo caused an undefined symbol reference.
    - A structure field name did not match the corresponding C name due to a typo.
    - Some structured fields were not properly aligned.
    - The long/ulong types were wrongly mapped to 64-bit types.
    - A typo in a /include directive caused a compilation error.
    - Doc files copy now converts from UTF-8 and split long lines.
    - Adjust /include file name mapping translation for proper prefix handling.
2015-04-16 16:04:06 +08:00
Daniel Veillard
213f1fe0d7 CVE-2015-1819 Enforce the reader to run in constant memory
One of the operation on the reader could resolve entities
leading to the classic expansion issue. Make sure the
buffer used for xmlreader operation is bounded.
Introduce a new allocation type for the buffers for this effect.
2015-04-14 17:41:48 +08:00
Martin von Gagern
8985cde709 xmlMemUsed is not thread-safe
For https://bugzilla.gnome.org/show_bug.cgi?id=747437
just use the mutex to protect access to those variables
2015-04-13 16:32:14 +08:00
Shaun McCance
7607d9dd45 Allow HTML serializer to output HTML5 DOCTYPE
For https://bugzilla.gnome.org/show_bug.cgi?id=747301

Use simple HTML5 DOCTYPE for about:legacy-compat

HTML5 uses a DOCTYPE without a PUBLIC or SYSTEM identifier. It looks
like this:

<!DOCTYPE html>

I can't use XSLT to output this, because to get a DOCTYPE I have to
provide a PUBLIC or SYSTEM identifier. Luckily, the standards folks
recognized this and provided this semantically equivalent form for the
HTML DOCTYPE:

<!DOCTYPE html SYSTEM "about:legacy-compat">

But people don't like seeing the "legacy" identifier in their output.
They'd rather see the shiny new DOCTYPE. Since we know that
about:legacy-compat is defined by the W3C to be semantically equivalent
to the sans-SYSTEM DOCTYPE, we could just special-case it in the HTML
serializer in libxml2. So if you set the SYSTEM identifier to
"about:legacy-compat", you get an HTML5 short-form DOCTYPE.
2015-04-03 22:52:36 +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
Nick Wellnhofer
02b252d7a2 Regression test for bug #695699 2015-03-08 17:00:37 +01:00
Nick Wellnhofer
342658a132 Add a couple of XPath tests 2015-03-08 16:46:04 +01:00
Nick Wellnhofer
ba58f23c60 Fix order of root nodes
Make sure root nodes are sorted before other nodes.
2015-03-08 16:44:11 +01:00
Nick Wellnhofer
f6aaabce85 Allow attributes on descendant-or-self axis
If the context node is an attribute, the attribute itself is on the
descendant-or-self axis. The principal node type of this axis is element,
so the only node test that can return the attribute is "node()". In other
words, "@attr/descendant-or-self::node()" is equivalent to "@attr".

This matches the behavior of Saxon-CE.
2015-03-08 16:25:52 +01:00
Steve Nairn
620a70615e Fix the fix to Windows locking
For https://bugzilla.gnome.org/show_bug.cgi?id=737851

Unfortunately this change has introduced a problem which results in
occasional hangs on Windows when running multi-threaded on a multi-core
host.

When locking the xmlRMutex the count field is increment inside the
critical section but when unlocking the count field is decremented
outside the critical section. The increment/decrement is not atomic so
this can result in the count field being updated incorrectly.

The solution is to change xmlRMutexUnlock to decrement the count field
before leaving the critical section rather than after.
2015-03-03 19:42:01 +08:00
Christopher Swenson
9b987f8c98 Fix timsort invariant loop re: Envisage article
See http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/

We use a "runLen" array of size 128, so it should be nearly impossible
to have our implementation overflow.

But in any case, the fix is relatively simple -- checking two extra
conditions in the invariant calculation.

I also took this opportunity to remove some redundancy in the
left/right merge logic in the invariant loop.
2015-02-27 14:55:49 +08:00
Daniel Veillard
9b8512337d Cleanup conditional section error handling
For https://bugzilla.gnome.org/show_bug.cgi?id=744980

The error handling of Conditional Section also need to be
straightened as the structure of the document can't be
guessed on a failure there and it's better to stop parsing
as further errors are likely to be irrelevant.
2015-02-23 11:29:20 +08:00
Daniel Veillard
a7dfab7411 Stop parsing on entities boundaries errors
For https://bugzilla.gnome.org/show_bug.cgi?id=744980

There are times, like on unterminated entities that it's preferable to
stop parsing, even if that means less error reporting. Entities are
feeding the parser on further processing, and if they are ill defined
then it's possible to get the parser to bug. Also do the same on
Conditional Sections if the input is broken, as the structure of
the document can't be guessed.
2015-02-23 11:17:35 +08:00
Tomas Radej
fb8e9e212f Add Python 3 rpm subpackage
Allow compilation and packaging of both python2 and python3
when present
2015-02-18 22:47:13 +08:00
Samuel Martin
3211973961 libxml2-config.cmake.in: update include directories
Align the include directories on those from the pkg-config module.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2015-02-13 01:53:07 +01:00
Nick Wellnhofer
220a7baeee Don't add IDs in xmlSetTreeDoc
This partially reverts my previous commit fixing bug #741919.
2014-12-23 21:28:37 +01:00
Michael Heimpold
fff8a6b87e threads: use forward declarations only for glibc
Fixes bug #704908

The declarations of pthread functions, used to generate weak references
to them, fail to suppress macros. Thus, if any pthread function has
been provided as a macro, compiling threads.c will fail.
This breaks on musl libc, which defines pthread_equal as a macro (in
addition to providing the function, as required).

Prevent the declarations for e.g. musl libc by refining the condition.

The idea for this solution was borrowed from the alpine linux guys, see
http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
2014-12-22 11:12:12 +08:00
Nick Wellnhofer
f54d6a929a Account for ID attributes in xmlSetTreeDoc 2014-12-19 00:09:03 +01:00
Daniel Veillard
7580ce0a7f Update Win32 configure.js to search for configure.ac
as configure.in was renamed
2014-10-28 18:13:53 +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
df23f584fd Adding example from bugs 738805 to regression tests
For https://bugzilla.gnome.org/show_bug.cgi?id=738805

Tortuous test case provided by pierre.labastie@neuf.fr
2014-10-23 13:52:47 +08:00
Daniel Veillard
72a46a519c Fix missing entities after CVE-2014-3660 fix
For https://bugzilla.gnome.org/show_bug.cgi?id=738805

The fix for CVE-2014-3660 introduced a regression in some case
where entity substitution is required and the entity is used
first in anotther entity referenced from an attribute value
2014-10-23 11:35:36 +08:00
Daniel Veillard
f65128f382 Revert "Missing initialization for the catalog module"
This reverts commit 054c716ea1.
As this break xmlcatalog command
https://bugzilla.redhat.com/show_bug.cgi?id=1153753
2014-10-17 17:13:41 +08:00
Daniel Veillard
726f67e2f1 Release of libxml2-2.9.2 2014-10-16 15:40:16 +08:00
Daniel Veillard
2fcdb42409 Forgot to add the cmake Makefile 2014-10-16 15:39:41 +08:00
Daniel Veillard
be2a7edaf2 Fix for CVE-2014-3660
Issues related to the billion laugh entity expansion which happened to
escape the initial set of fixes
2014-10-16 13:59:47 +08:00
Bart De Schuymer
500c54ef32 fix memory leak xml header encoding field with XML_PARSE_IGNORE_ENC
When the xml parser encounters an xml encoding in an xml header while
configured with option XML_PARSE_IGNORE_ENC, it fails to free memory
allocated for storing the encoding.
The patch below fixes this.
How to reproduce:
1. Change doc/examples/parse4.c to add xmlCtxtUseOptions(ctxt,
XML_PARSE_IGNORE_ENC); after the call to xmlCreatePushParserCtxt.
2. Rebuild
3. run the following command from the top libxml2 directory:
LD_LIBRARY_PATH=.libs/ valgrind --leak-check=full
./doc/examples/.libs/parse4 ./test.xml , where test.xml contains
following
input:
<?xml version="1.0" encoding="UTF-81" ?><hi/>
valgrind will report:
==1964== 10 bytes in 1 blocks are definitely lost in loss record 1 of 1
==1964==    at 0x4C272DB: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1964==    by 0x4E88497: xmlParseEncName (parser.c:10224)
==1964==    by 0x4E888FE: xmlParseEncodingDecl (parser.c:10295)
==1964==    by 0x4E89630: xmlParseXMLDecl (parser.c:10534)
==1964==    by 0x4E8B737: xmlParseTryOrFinish (parser.c:11293)
==1964==    by 0x4E8E775: xmlParseChunk (parser.c:12283)

Signed-off-by: Bart De Schuymer <bart at amplidata com>
2014-10-16 12:17:20 +08:00
Roumen Petrov
974db365de AC_CONFIG_FILES and executable bit 2014-10-16 12:07:43 +08:00
Roumen Petrov
f3efaba30e remove HAVE_CONFIG_H dependency in testlimits.c 2014-10-16 12:01:09 +08:00
Roumen Petrov
c2450d8ba3 fix some tabs mixing incompatible with python3 2014-10-16 11:46:35 +08:00
Roumen Petrov
21fec4999b win32/libxml2.def.src after rebuild in doc 2014-10-16 11:44:33 +08:00
Roumen Petrov
4bb03d7a80 elfgcchack.h: more legacy needs xmlSAX2StartElement() and xmlSAX2EndElement() 2014-10-16 11:42:21 +08:00
Roumen Petrov
c7684f9b2e elfgcchack.h: add xmlXPathNodeEval and xmlXPathSetContextNode
(after rebuild in doc)
2014-10-16 11:41:55 +08:00
Yegor Yefremov
7446445dec xmlmemory: handle realloc properly
If realloc fails, free original pointer.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2014-10-13 20:46:37 +08:00
Samuel Martin
fa23ac1a79 Provide cmake module
* add libxml2-config.cmake.in template
* configure.ac: add libxml2-config.cmake.in to the configured file list
* Makefile.am: install libxml2-config.cmake under ${libdir}/cmake/libxml2

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
2014-10-13 18:02:53 +08:00
Daniel Veillard
af62eb4fab Python generator bug raised by the const change
the doc methode for xmlDocGetRootElement wasn't generated anymore
2014-10-13 16:40:56 +08:00
Daniel Veillard
7a72f4afd5 Fix a couple of issues raised by make dist 2014-10-13 16:23:24 +08:00
Kurt Roeckx
95ebe53b50 Fix and add const qualifiers
For https://bugzilla.gnome.org/show_bug.cgi?id=689483

It seems there are functions that do use the const qualifier for some of the
arguments, but it seems that there are a lot of functions that don't use it and
probably should.

So I created a patch against 2.9.0 that makes as much as possible const in
tree.h, and changed other files as needed.

There were a lot of cases like "const xmlNodePtr node".  This doesn't actually
do anything, there the *pointer* is constant not the object it points to. So I
changed those to "const xmlNode *node".

I also removed some consts, mostly in the Copy functions, because those
functions can actually modify the doc or node they copy from
2014-10-13 16:06:21 +08:00
Francis Dupont
12fd654340 Visual Studio 14 CTP defines snprintf()
For https://bugzilla.gnome.org/show_bug.cgi?id=737937

Visual Studio 14 CTP (the VS which comes with Windows 10) defines snprintf().
It could be seen as a good idea as snprintf() is part of the C99 standard but
unfortunately libxml2 as many packages defines snprintf as _snprintf, the
function to use for any previous versions of the Visual Studio runtime. More,
to avoid hiding/shadowing snprintf() declaration in stdio.h is protected by an
"#ifdef snprintf" followed by an "#error", so compilation fails.

But the fix is easy: the corresponding C/C++ compiler defines _MSC_VER to 1900
so it is enough to guard the snprintf define against it, cf. the attached patch
for win32config.h (from 2.9.1 "latest" tarball).
2014-10-13 15:09:43 +08:00
Daniel Veillard
8854e46318 Windows Critical sections not released correctly
For https://bugzilla.gnome.org/show_bug.cgi?id=737851
Based on report from mike.vanduzee@caris.com , we were missing calling
LeaveCriticalSection() when count was down to 0 hence not freeing
adequately the related resource.
2014-10-13 15:03:58 +08:00
Patrick Monnerat
5018082b8c OS400: do not try to copy unexisting doc files 2014-10-10 15:37:39 +08:00
Patrick Monnerat
ad160cb3c4 OS400: use either configure.ac or configure.in. 2014-10-10 15:36:48 +08:00
Daniel Veillard
d0dc58135a Removal of old configure.in 2014-10-10 15:35:10 +08:00
Daniel Veillard
f985ada790 Preparing for upcoming release of 2.9.2
Moving configure.in to configure.ac since all tools complain about it
2014-10-09 23:59:36 +08:00
Daniel Veillard
7cf57380b1 Parser error on repeated recursive entity expansion containing &lt;
For https://bugzilla.gnome.org/show_bug.cgi?id=736417

basically a weird side effect and a failure
to properly parenthesize a boolean expression led to this bug
2014-10-08 16:09:56 +08:00
Dmitriy
7dc2496509 Fix zlib and lzma libraries check via command line
For https://bugzilla.gnome.org/show_bug.cgi?id=737532

add save, change and restore LDFLAGS before AC_CHECK_LIB call
when functions gzread and lzma_code are searching inside action-if-found
of AC_CHECK_HEADERS
2014-10-07 18:59:00 +08:00
Gaurav Gupta
f5496a1ef4 xpointer : fixing Null Pointers
For https://bugzilla.gnome.org/show_bug.cgi?id=738053
At many places in xpointer.c
Null check is missing which is dereferenced at later places.
2014-10-07 17:09:35 +08:00
Gaurav Gupta
a61929e8ca Remove Unnecessary Null check in xpointer.c
For https://bugzilla.gnome.org/show_bug.cgi?id=738052

superfluous check
2014-10-07 12:28:34 +08:00
Dennis Filder
7e9bbdf82f parser bug on misformed namespace attributes
For https://bugzilla.gnome.org/show_bug.cgi?id=672539
Reported by Axel Miller <axel.miller@ppi.de>

Consider the following start-tag:
<x xmlns=""version="">

The start-tag does not conform to the rule

[40]       STag       ::=       '<' Name (S Attribute)* S? '>'

since there is no whitespace in front of the attribute "version".

Thus, libxml2 should reject the start-tag.
But it doesn't:

$ echo '<x xmlns=""version=""/>' | xmllint -
<?xml version="1.0"?>
<x xmlns="" version=""/>

The error seems to happen only if there is a namespace declaration in
front of
the attribute. A missing whitespace between other attributes is handled
correctly:

$ echo '<x someattr=""version=""/>' | xmllint -
-:1: parser error : attributes construct error
<x someattr=""version=""/>
              ^
[...]
2014-10-06 20:34:14 +08:00
Gaurav Gupta
6d93e9eacf Unreachable code in tree.c
For https://bugzilla.gnome.org/show_bug.cgi?id=705392

Cut out an unused block
2014-10-06 20:20:00 +08:00