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

4324 Commits

Author SHA1 Message Date
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
Daniel Veillard
91309d3a1d Pointer dereferenced before null check
For https://bugzilla.gnome.org/show_bug.cgi?id=707027

A few pointer dereference before NULL check fixed.
Removed a useless test
2014-10-06 20:07:19 +08:00
Gaurav Gupta
d72cb06de9 Leak of struct addrinfo in xmlNanoFTPConnect()
For https://bugzilla.gnome.org/show_bug.cgi?id=732352

in case of error condition in IPv6 support, the early return here
doesn't call freeaddrinfo(result), thus leaking memory.
2014-10-06 19:28:29 +08:00
Daniel Veillard
292a9f293d Possible overflow in HTMLParser.c
For https://bugzilla.gnome.org/show_bug.cgi?id=720615

make sure that the encoding string passed is of reasonable size
2014-10-06 18:51:04 +08:00
John Beck
6bea543eca python/tests/sync.py assumes Python dictionaries are ordered
For https://bugzilla.gnome.org/show_bug.cgi?id=734017

Solaris has had libxml2 version 2.9.1 for a while, with Python versions 2.6 and
2.7.  While preparing to also build a module for Python 3.4, we ran into an
issue with the test case sync.py failing. The failure involved parsing a
string that included a Python dictionary, then complaining when the order of
the parsed result did not match the original order.  But Python dictionaries
are unordered by definition; see section 5.5 of
https://docs.python.org/2/tutorial/datastructures.html .  For whatever reason,
Python 2.6 and 2.7 always happened to report the pair of values back in their
original order, but with Python 3.4 the order is random.  The attached patch
allows for either order; it also fixes a typo that was repeated several times
thanks to the magic of copy & paste.
2014-10-06 18:26:27 +08:00
Juergen Keil
24fb4c329a wrong error column in structured error when parsing end tag
For https://bugzilla.gnome.org/show_bug.cgi?id=734283

libxml2 reports wrong error column numbers (field int2 in xmlError)
in structured error handler, after parsing an end tag.
2014-10-06 18:19:12 +08:00
Gaurav Gupta
d319eb9223 Fix Enum check and missing break
for https://bugzilla.gnome.org/show_bug.cgi?id=737403

In file xmlreader.c
1. An enum is checked to proper value instead of checking like a boolean.
2. Missing break statement added.
2014-10-06 12:24:17 +08:00
Philip Withnall
21699937b0 xmlIO: Handle error returns from dup()
If dup() fails and returns -1, gzdopen() will transparently return NULL,
but then close() will fail after being called on an invalid FD. Change
the code to only call close() on valid FDs.

Coverity issue: #72382
2014-10-06 11:53:39 +08:00
Patrick Monnerat
98d71f9191 os400: make-src.sh: create physical file with target CCSID 2014-10-04 21:13:48 +08:00
Patrick Monnerat
5378ff9378 OS400: Add some more C macros equivalent procedures. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
bce6a61e68 OS400: use C macros to implement equivalent RPG support procedures. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
02fd129874 OS400: implement XPath macros as procedures for ILE/RPG support. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
917e353f2b OS400: include in distribution tarball. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
c017988305 OS400: Add README: compilation directives and OS/400 specific stuff. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
e72b4e7389 OS400: Add compilation scripts. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
e083c30e12 OS400: ILE RPG language header files. 2014-10-04 21:13:48 +08:00
Patrick Monnerat
7d888f07d8 OS400: implement some macros as functions for ILE/RPG language support (that as no macros). 2014-10-04 21:13:47 +08:00
Patrick Monnerat
6e4d870336 OS400: UTF8<-->EBCDIC wrappers for system and external library calls 2014-10-04 21:13:47 +08:00
Patrick Monnerat
5621c81b49 OS400: Easy character transcoding support 2014-10-04 21:13:47 +08:00
Patrick Monnerat
17951ea289 OS400: iconv functions compatibility wrappers and table builder. 2014-10-04 21:13:47 +08:00
Patrick Monnerat
ea8c89b9b5 doc/news.html: small update to avoid line join while generating NEWS. 2014-10-04 21:13:47 +08:00
Patrick Monnerat
a6c5b022f1 OS400: create architecture directory. Implement dlfcn emulation. 2014-10-04 21:13:47 +08:00
Daniel Veillard
beb7281055 Fix a problem properly saving URIs
As written by Martin Kletzander <mkletzan@redhat.com>:
Since commit 8eb55d782a, when you parse
and save an URI that has no server (or similar) part, two slashes
after the 'schema:' get lost.  It means 'uri:///noserver' is turned
into 'uri:/noserver'.

basically
   foo:///only/path

means a host of "" while

   foo:/only/path

means no host at all

  So the best fix IMHO is to fix the URI parser to record the first
case and an empty host string and the second case as a NULL host string

 I would not revert the initial patch, we should not 'invent' those
slash, but we should instead when parsing keep the information that
it's a host based path and that foo:/// means the presence of a host
but an empty one.

Once applied the resulting patch below, all cases seems to be saved
properly:

thinkpad:~/XML -> ./testURI uri:/noserver
uri:/noserver
thinkpad:~/XML -> ./testURI uri:///noserver
uri:///noserver
thinkpad:~/XML -> ./testURI uri://server/foo
uri://server/foo
thinkpad:~/XML -> ./testURI uri:/noserver/foo
uri:/noserver/foo
thinkpad:~/XML -> ./testURI uri:///
uri:///
thinkpad:~/XML -> ./testURI uri://
uri://
thinkpad:~/XML -> ./testURI uri:/
uri:/
thinkpad:~/XML ->

  If you revert the initial patch that last case fails

The problem is that I don't want to change the xmlURI structure to
minimize ABI breakage, so I could not extend the field. The natural
solution is to denote that uri:/// has an empty host by making
the uri server field an empty string which works very well but breaks
applications (like libvirt ;-) who blindly look at uri->server
not being NULL to try to reach it !
Simplest was to stick the port to -1 in that case, instead of 0
application don't bother looking at the port of there is no server
string, this makes the patch more complex than a 1 liner, but
is better for ABI.
2014-10-03 19:22:39 +08:00
Ron Angeles
b3e488b0d9 Add methods for python3 iterator
xmlCoreDepthFirstItertor and xmlCoreBreadthFirstItertr only
implement a python2-compatible iterator interface. The next()
method has been changed to __next__(). An alias has been
defined to keep python2 compatibility.
2014-10-03 17:01:24 +08:00
Juergen Keil
33f658c969 wrong error column in structured error when parsing attribute values
For https://bugzilla.gnome.org/show_bug.cgi?id=734280

libxml2 reports wrong error column numbers (field int2 in xmlError)
in structured error handler, after parsing XML attribute values.

Example XML:

<?xml version="1.0" encoding="UTF-8"?>
<root
xmlns="urn:colbug">&</root>
<!--
         1         2         3         4
1234567890123456789012345678901234567890
-->

Expected location of the error would be line 3, column 21.

The actual location of the error is line 3, column 9:

$ ./xmlparse colbug2.xml
colbug2.xml:3:9: xmlParseEntityRef: no name

The 12 characters of the xmlns attribute value "urn:colbug" are
not accounted for in the error column value.
2014-08-07 17:30:36 +08:00
Juergen Keil
5d4310af45 wrong error column in structured error when skipping whitespace in xml decl
For https://bugzilla.gnome.org/show_bug.cgi?id=734276

libxml2 reports wrong error column numbers (field int2 in xmlError)
in structured error handler, after an XML declaration containing
whitespace.

Example XML:

<?xml  version="1.0"  encoding="UTF-8"     ?><root>&</root>
<!--
         1         2         3         4         5         6
123456789012345678901234567890123456789012345678901234567890
-->

Expected location of the error would be line 1, column 53.

The actual location of the error is line 1, column 44:

$ ./xmlparse colbug1.xml
colbug1.xml:1:44: xmlParseEntityRef: no name
2014-08-07 16:28:09 +08:00
Juergen Keil
d201e71ed0 no error column in structured error handler for xml schema validation errors
For https://bugzilla.gnome.org/show_bug.cgi?id=734363

When using xml schema validation, structured error callbacks do not get
passed a valid column number in xmlError field "int2".

$ ./xmlsaxparse colbug5.xml colbug5.xsd
colbug5.xml:3:0: Element '{urn:colbug5}bx': This element is not
expected.
Expected is ( {urn:colbug5}b ).

The schema error is reported for line 3, column 0 (= N/A).

I'd like to have the column number of the error passed in the xmlError
structure.  With this test case: line 3, column 9.
2014-08-07 11:42:07 +08:00
Gaurav Gupta
658b86c0ea 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
2014-08-07 11:19:03 +08:00
Kyle VanderBeek
1db9969966 Support element node traversal in document fragments.
https://bugzilla.gnome.org/show_bug.cgi?id=733900
2014-08-05 19:29:06 +08:00
Gaurav Gupta
b8480ae781 Remove a couple of dead conditions
For https://bugzilla.gnome.org/show_bug.cgi?id=733711
2014-07-26 21:14:53 +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
Daniel Veillard
2f9b126a5c typo in error messages "colon are forbidden from..."
For https://bugzilla.gnome.org/show_bug.cgi?id=731511
Pointed byt vincent Lefevre
2014-07-26 20:29:36 +08:00
Philip Withnall
4ba5d31769 xmlschemastypes: Fix potential array overflow
The year and month need validating before being put into the
MAX_DAYINMONTH macro.

Coverity issue: #60436

https://bugzilla.gnome.org/show_bug.cgi?id=731990
2014-07-26 20:20:11 +08:00
Philip Withnall
5777ae75ee runtest: Fix a memory leak on parse failure
Coverity issue: #60439

https://bugzilla.gnome.org/show_bug.cgi?id=731990
2014-07-26 20:16:33 +08:00
Philip Withnall
31aa38158a xmlIO: Fix an FD leak on gzdopen() failure
According to the documentation, gzdopen() does not close the FD on
failure (but does effectively close it on success, since gzclose()
closes it).

Coverity issues: #60440, #60441

https://bugzilla.gnome.org/show_bug.cgi?id=731990
2014-07-26 20:13:11 +08:00