1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-14 22:50:08 +03:00

4335 Commits

Author SHA1 Message Date
Daniel Veillard
18e1f1f118 Improvements for old buffer compatibility
Now tree.h exports LIBXML2_NEW_BUFFER macro indicating that the
API uses the new buffers, important to keep code working with
both versions.
* tree.h buf.h: also export xmlBufContent(), xmlBufEnd(), and xmlBufUse()
          to help port the old code
* buf.c: make sure the compatibility counters are updated on
          buffer usage, to keep proper working of application compiled
	  against the old structures, but take care of int overflow
2012-08-06 10:16:41 +08:00
Daniel Veillard
3f0c613f28 Expand the limit test program 2012-08-03 12:04:09 +08:00
Daniel Veillard
5353bbf7dd More fixups on the push parser behaviour 2012-08-03 12:03:31 +08:00
Daniel Veillard
2b52aa0050 Strengthen behaviour of the push parser in problematic situations
Implement the maximum lookahead stategy, and fix some handling
of DTD to speed up processing.
2012-07-31 10:53:47 +08:00
Daniel Veillard
e7bf892d8c Improve error reporting on parser errors
The extra string was being dismissed when provided.
* parser.c: handle bot case properly
* result/: this changes a few error reports
2012-07-30 20:09:25 +08:00
Daniel Veillard
48b4cdde34 Enforce XML_PARSER_EOF state handling through the parser
That condition is one raised when the parser should positively stop
processing further even to report errors. Best is to test is after
most GROW call especially within loops
2012-07-30 16:16:04 +08:00
Daniel Veillard
0df83cae70 Fixup limits parser 2012-07-30 15:41:10 +08:00
Daniel Veillard
cd852ad154 Implement some default limits in the XPath module
This adds some internal limitationson XPath expression complexity,
and limits at runtime like depth of the stack and maximum size
for nodeset.
* xpath.c: implement the above as well as the maximum Name lenght
2012-07-30 10:12:18 +08:00
Daniel Veillard
52d8ade7a7 Introduce some default parser limits
Those can be overrided by the XML_PARSE_HUGE option, they
are just default limits for Name lenght, dictionary size limits
and maximum amount of parser lookup.
* include/libxml/parserInternals.h: define the limits
* include/libxml/xmlerror.h: add a new error
* parser.c parserInternals.c: implements the new limits
2012-07-30 10:08:45 +08:00
Daniel Veillard
7c693dad23 Cleanups and new limit APIs for dictionaries
* include/libxml/dict.h dict.c: adding 2 new functions xmlDictGetUsage
  and xmlDictSetLimit allowing to review the amount of memory allocated
  for dictionary strings. Aslo cleanup of various signed int used as
  size values in the code.
2012-07-25 16:32:18 +08:00
Daniel Veillard
6f6feba876 Fixup for buf.c 2012-07-25 16:30:56 +08:00
Daniel Veillard
5756038650 Cleanup URI module memory allocation code
* uri.c: cleanup the code doing the allocations, set up a structured
  error handler to report memory errors, and set up an abitrary
  limit on URI saving size
* error.c include/libxml/xmlerror.h: add a new FROM_URI indication
  for structured error reporting, also adding strings for schematron
  and buffer which were missing
2012-07-24 11:44:23 +08:00
Daniel Veillard
747c2c1083 Extend testlimits 2012-07-23 14:24:28 +08:00
Daniel Veillard
f572a78d58 More avoid quadratic behaviour 2012-07-23 14:24:28 +08:00
Daniel Veillard
5130481646 Impose a reasonable limit on PI size
Unless the XML_PARSE_HUGE option is given to the parser,
the value is XML_MAX_TEXT_LENGTH, i.e. the same than for a
text node within content.
Also cleanup some unsigned int used for memory size.
2012-07-23 14:24:28 +08:00
Daniel Veillard
0de1f3114a first version of testlimits new test
Used to check behaviour on various parsing limits
2012-07-23 14:24:28 +08:00
Daniel Veillard
6568645164 Avoid quadratic behaviour in some push parsing cases
avoid rescanning over and over a very long input, just check
the incoming chunks
2012-07-23 14:24:28 +08:00
Daniel Veillard
58f73aca1a Impose a reasonable limit on comment size
Unless the XML_PARSE_HUGE option is given to the parser,
the value is XML_MAX_TEXT_LENGTH, i.e. the same than for a
text node within content.
Also cleanup some unsigned int used for memory size.
2012-07-23 14:24:28 +08:00
Daniel Veillard
e17db9946c Impose a reasonable limit on attribute size
Unless the XML_PARSE_HUGE option is given to the parser,
the value is XML_MAX_TEXT_LENGTH, i.e. the same than for a
text node within content.
2012-07-23 14:24:27 +08:00
Daniel Veillard
b60e612e87 Small cleanup of unused variables in test 2012-07-23 14:24:27 +08:00
Daniel Veillard
9ee02f80a4 Harden the buffer code and make it more compatible
Mimic the old xmlBuffer strcture in xmlBuf to avaoid catastrophic
failures in case of old code directly reading ctxt->input->buf->buffer

Check on all buffer entry points if an error previously occured on
the buffer, and fail the operation if this is the case, the buffer
becomes immutable and unreadable.
2012-07-23 14:24:27 +08:00
Daniel Veillard
00ac0d3b96 More cleanups for input/buffers code
When calling xmlParserInputBufferPush, the buffer may be reallocated
and at the input level the pointers for base, cur and end need to
be reevaluated.
* buf.c buf.h: add two new functions, one to get the base from the
  input of the buffer, and another one to reset the pointers based
  on the cur and base inded
* HTMLparser.c parser.c: cleanup to use the new helper functions
  as well as making sure size_t is used for the indexes computations
2012-07-23 14:24:27 +08:00
Daniel Veillard
61551a1eb7 Cleanup function xmlBufResetInput() to set input from Buffer
This was scattered in a number of modules, xmlParserInputPtr
have usually their base, cur and end pointer set from an
xmlBuf used as input.
* buf.c buf.h: add a new function implementing this setup
* parser.c HTMLparser.c catalog.c parserInternals.c xmlreader.c
  use the new function instead of digging into the buffer in
  all those modules
2012-07-23 14:24:27 +08:00
Daniel Veillard
145477d8ab Swicth the test program for characters to new input buffers
it was manipulating the buffer content and structures directly
this cleans it up
2012-07-23 14:24:27 +08:00
Daniel Veillard
7b9b07198f Convert the HTML tree module to the new buffers
The new input buffers induced a couple of changes, the others
are related to the switch to xmlBuf in saving routines.
2012-07-23 14:24:27 +08:00
Daniel Veillard
a78d803639 Convert of the HTML parser to new input buffers
Changes similar to the ones done in the XML parser for the
routines which are not shared.
2012-07-23 14:24:27 +08:00
Daniel Veillard
dbf5411b21 Convert the writer to new output buffer and save APIs
Only a handful of places had to be converted for xmlBuf and
the new saving entry point.
2012-07-23 14:24:27 +08:00
Daniel Veillard
8aebce3ec6 Convert XMLReader to the new input buffers
A few direct access were replaced, and also one internal
xmlBuffer structure is converted to use xmlBuf instead
2012-07-23 14:24:27 +08:00
Daniel Veillard
50cdab5552 New saving functions using xmlBuf and conversion
* save.h: new header providing new functions currently internal
          and xmlBuf counterparts of old xmlBuffer based ones
* xmlsave.c: convert functions to use xmlBuf as much as possible
2012-07-23 14:24:27 +08:00
Daniel Veillard
dddeede060 Provide new xmlBuf based saving functions
* include/libxml/tree.h: adds xmlBufGetNodeContent and xmlBufNodeDump
  as xmlBuf based equivalents of xmlNodeGetContent and xmlNodeDump
* tree.c: implements one new routine and converts xmlNodeBufGetContent
  to use the xmlBuf equivalent. It should behave better as a result
  in case of data larger than 2GB.
2012-07-23 14:24:27 +08:00
Daniel Veillard
345ee8b620 Convert XInclude to the new input buffers
A few xmlBuffer...() calls changed to their xmlBuf...() counterparts
2012-07-23 14:24:27 +08:00
Daniel Veillard
2a1d2422a4 Convert catalog code to the new input buffers
Only one place where the buffers fields where accessed directly
2012-07-23 14:24:27 +08:00
Daniel Veillard
53aa293dd3 Convert C14N to the new Input buffer
one case of direct access cleaned up
2012-07-23 14:24:27 +08:00
Daniel Veillard
a6a6e70c47 Convert xmlIO.c to the new input and output buffers
Relatively mechanical changes, this also led to a couple of fixes
upon review of the I/O code on buffer usage.
2012-07-23 14:24:26 +08:00
Daniel Veillard
768eb3b82d Convert XML parser to the new input buffers
The main changes are when the internal of the buffers structure
were adressed directly, we now use routines coming from buf.h
The routine xmlParserInputRead() which wasn't used anywhere is
deprecated too.
2012-07-23 14:24:26 +08:00
Daniel Veillard
65c7d3b2e6 Incompatible change to the Input and Output buffers
Since the whole set of structures was public, the only way
to switch to size_t clean buffer is to introduce an incompatible
API change. Modifying the xmlParserInputBuffer and xmlOutputBuffer
structures is the best place to make this change as those
structures are deep into the parser feeding data, and no public
API suggest to build those manually.
2012-07-23 14:24:26 +08:00
Daniel Veillard
18d0db2503 Adding new encoding function to deal with the new structures
* encoding.c: adds xmlCharEncFirstLineInput, xmlCharEncInput and
  xmlCharEncOutput
* enc.h: the functions are not made public but added to this new header
2012-07-23 14:24:26 +08:00
Daniel Veillard
ade10f2c57 Convert XPath to xmlBuf
Easy as no buffer was exported in the APIs
2012-07-23 14:24:26 +08:00
Daniel Veillard
bca22f40c3 Adding a new buf module for buffers
This also add converter functions between xmlBuf and xmlBuffer
* buf.c buf.h: the old xmlBuffer routines but modified for size_t
  and using xmlBuf instead of xmlBuffer
* Makefile.am: add the 2 new files
* include/libxml/xmlerror.h: add an entry for the new module
* include/libxml/tree.h: expose the xmlBufPtr type but not the
  structure which stay private
2012-07-23 14:24:26 +08:00
Daniel Veillard
4629ee02ac Do not fetch external parsed entities
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
2012-07-23 14:15:40 +08:00
Aron Xu
baaf03f80f Fix an error in previous commit 2012-07-20 15:41:34 +08:00
Daniel Veillard
4f9fdc709c Fix entities local buffers size problems 2012-07-18 17:54:05 +08:00
Daniel Veillard
459eeb9dc7 Fix parser local buffers size problems 2012-07-18 17:54:04 +08:00
Daniel Veillard
740cb1a450 Memory error within SAX2 reuse common framework
There is no reason for that class of errors to not use
the same handling allowing strctured error processing.
2012-07-18 17:48:32 +08:00
Daniel Veillard
c508fa3f0b Fix a failure to report xmlreader parsing failures
Related to https://bugzilla.gnome.org/show_bug.cgi?id=654567
the problem is that the provided patch failed to raise an error
on xmlTextReaderRead() return when an actual parsing error occured
2012-07-18 17:48:06 +08:00
Daniel Veillard
549f06a8bd Expand .gitignore with more files 2012-07-11 15:21:12 +08:00
Daniel Veillard
8fc913fcc9 Fix compilation on older Visual Studio
For https://bugzilla.gnome.org/show_bug.cgi?id=666491

Reported by Matt Budd <matt.budd@gmail.com>, the added support
for VS 2010 broke older version 2005 and 2008 because it assumed
some of the defines where present in all versions, fix that
to check the version of VS
2012-06-06 11:29:29 +08:00
Daniel Veillard
2e1eaca637 Fix xmllint --xpath node initialization
By default it's more sensible to initialize it to the document itself
than the root element
2012-05-25 16:44:20 +08:00
Daniel Veillard
c943f708f1 Release of libxml2-2.8.0
- Makefile.am: don't package .git
- configure.in : update to new release
- doc/xml.html: added the new release
- doc/* testapi.c: regenerated
v2.8.0
2012-05-23 17:10:59 +08:00
Daniel Veillard
22030ef888 Restore code for Windows compilation
Try to keep as close to rc1 but still allow the change from Roumen for
mingw
2012-05-23 15:52:45 +08:00