summaryrefslogtreecommitdiff
path: root/encoding.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix unused parameter warning without ICUNick Wellnhofer2017-11-091-0/+1
|
* Fixed ICU to set flush correctly and provide pivot buffer.Joel Hockey2017-11-041-21/+25
| | | | | | | | | | By always setting flush=TRUE when doing multiple reads, ICU will not correctly handle truncated utf8 chars across read boundaries. The fix is to set flush=TRUE only on final read, and to provide a pivot buffer which is maintained by libxml between calls to ucnv_convertEx.
* Fix pathological performance when outputting charrefsNick Wellnhofer2017-06-191-70/+59
| | | | | | | | | | | | | | If a character can't be represented in the output encoding, it is converted to a character reference. This used to to replace the character in the input stream by calling xmlBufAddHead or xmlBufferAddHead. These functions shifted the entire input array around, leading to quadratic performance when converting a run of non-representable characters. This is most pronounced when dumping to memory. Output the charref directly instead. Found with libFuzzer.
* Deduplicate code in encoding.cNick Wellnhofer2017-06-191-312/+153
| | | | | Introduce static functions xmlEncInputChunk and xmlEncOutputChunk that handle the internal/iconv/ICU branching.
* Fix some format string warnings with possible format string vulnerabilityDavid Kilzer2016-05-231-1/+1
| | | | | | | | 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.
* Avoid a possibility of dangling encoding handlerGaurav2013-11-291-2/+14
| | | | | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=711149 In Function: int xmlCharEncCloseFunc(xmlCharEncodingHandler *handler) If the freed handler is any one of handlers[i] list, then it will make that hanldlers[i] as dangling. This may lead to crash issues at places where handlers is read.
* #705267 - add additional defines checks for support "./configure --with-minimum"Denis Pauk2013-08-031-0/+2
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=705267
* Fix the flushing out of raw buffers on encoding conversionsDaniel Veillard2013-02-131-3/+4
| | | | | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=692915 the new set of converting functions tried to limit the encoding conversion of the raw buffer to the consumption one to work in a more progressive fashion. Unfortunately this was bad for performances and led to errors on progressive parsing when a very large chunk was close to the end of the document. Fix the new internal function and switch back to the old way of converting. Fix another bug in the process.
* Try IBM-037 when looking for EBCDIC handlersPetr Sumbera2012-12-121-0/+2
| | | | | http://en.wikipedia.org/wiki/EBCDIC_037 as it is another variat of EBCDIC
* Big space and tab cleanupDaniel Veillard2012-09-111-3/+3
| | | | Remove all space before tabs and space and tabs at end of lines.
* Regenerating docs and API filesDaniel Veillard2012-08-101-2/+2
| | | | | | | | | | | | Various cleanups * configure.in: force regeneration of APIs in my environment * buf.c buf.h enc.h encoding.c include/libxml/tree.h include/libxml/xmlerror.h save.h tree.c: various comment cleanups pointed by apibuild * doc/apibuild.py: added the 3 new internal headers in the excludes * doc/libxml2-api.xml doc/libxml2-refs.xml: regenerated the API * doc/symbols.xml: listing new entry points for 2.9.0 * doc/devhelp/*: regenerated
* Adding new encoding function to deal with the new structuresDaniel Veillard2012-07-231-4/+479
| | | | | | * encoding.c: adds xmlCharEncFirstLineInput, xmlCharEncInput and xmlCharEncOutput * enc.h: the functions are not made public but added to this new header
* Prevent an infinite loop when dumping a node with encoding problemsTimothy Elliott2012-05-081-2/+18
| | | | | | | | | | | | | | | | When a node is dumped with a new encoding, we may encounter characters that are not supported in the new encoding. libxml2 handles this by replacing the character with character references, but in some encodings this can result in an infinite loop when the character references themselves contain unsupported characters. This fixes the infinite loop by undoing a character reference substitution when it cannot be inserted, and returning an encoder error. This bug was noticed when looking into an infinite loop bug report for the Ruby Nokogiri project. The original bug report, "nokogiri process hangs on call to inner_html" is here: https://github.com/tenderlove/nokogiri/issues/400
* Fix an off by one error in encodingDaniel Veillard2011-08-191-2/+2
| | | | | this off by one error doesn't seems to reproduce on linux but the error is real.
* 480323 add code to plug in ICU converters by defaultGiuseppe Iuculano2010-11-041-284/+525
| | | | | This is not configured in by default but after some serious massaging incorporate that patch from Chromium/Chrome.
* 630140 better fix for iso995x encoding errorDaniel Veillard2010-11-031-7/+3
| | | | | Changing semantic of xmlCharEncInFunc() wasn't the proper way to do this, better change UTF8ToISO8859x() appropriately
* Various cleanups on encoding handlingDaniel Veillard2010-11-031-36/+37
| | | | Done while chasing previous bug
* 630140 fix iso995x encoding errorDaniel Veillard2010-11-031-1/+5
| | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=630140 Fix the bug, which happen when using the embedded converters and not iconv
* A few more safety cleanup raised by scanDaniel Veillard2009-09-071-6/+9
| | | | | * SAX2.c encoding.c parser.c xmlschemas.c: a few more safety checks * relaxng.c: remove an unused intitialization
* Fixing assorted potential problems raised by scanDaniel Veillard2009-09-071-1/+1
| | | | | * encoding.c parser.c relaxng.c runsuite.c tree.c xmlreader.c xmlschemas.c: nothing really serious but better safe than sorry
* 566012 autodetected encoding and encoding conflictDaniel Veillard2009-08-261-11/+42
| | | | | | | * encoding.c parser.c parserInternals.c: when we autodetect an encoding but it's actually not completely compatible with the one declared great care must be taken to not convert more than just the first line. Led to some refactoring, more private functions and a bit of cleanup.
* 566012 Incomplete EBCDIC parsing supportMartin Kögler2009-08-241-0/+2
| | | | * encoding.c: the iconv converter is sometimes only found as "EBCDIC-US"
* make a new kind of buffer where shrinking and adding in head can avoidDaniel Veillard2008-08-301-3/+5
| | | | | | | | | | | * include/libxml/tree.h tree.c: make a new kind of buffer where shrinking and adding in head can avoid reallocation or full buffer memmoves * encoding.c xmlIO.c: use the new kind of buffers for output buffers Daniel svn path=/trunk/; revision=3787
* buffer may not be large enough to convert to UCS4, patch from ChristianDaniel Veillard2008-04-031-2/+2
| | | | | | | | * encoding.c: buffer may not be large enough to convert to UCS4, patch from Christian Fruth , fixes #504015 Daniel svn path=/trunk/; revision=3727
* poblem with encoding detection for UTF-16 reported by Ashwin and found byDaniel Veillard2008-03-061-2/+3
| | | | | | | | | | | * encoding.c: poblem with encoding detection for UTF-16 reported by Ashwin and found by Bill * test/valid/dtds/utf16b.ent test/valid/dtds/utf16l.ent test/valid/UTF16Entity.xml result/valid/UTF16Entity.xml*: added the example to the regression tests Daniel svn path=/trunk/; revision=3700
* patch from Roumen Petrov to detect if iconv() needs a const for the secondDaniel Veillard2008-02-151-1/+1
| | | | | | | | * config.h.in configure.in encoding.c: patch from Roumen Petrov to detect if iconv() needs a const for the second parameter Daniel svn path=/trunk/; revision=3693
* Fixed typo in xmlCharEncFirstLine pointed out by Mark Rowe (bug #440159)William M. Brack2007-05-221-6/+7
| | | | | | | | | | | | * encoding.c: Fixed typo in xmlCharEncFirstLine pointed out by Mark Rowe (bug #440159) * include/libxml/xmlversion.h.in: Added check for definition of _POSIX_C_SOURCE to avoid warnings on Apple OS/X (patch from Wendy Doyle and Mark Rowe, bug #346675) * schematron.c, testapi.c, tree.c, xmlIO.c, xmlsave.c: minor changes to fix compilation warnings - no change to logic. svn path=/trunk/; revision=3618
* remove a warning check with uppercase for AIX iconv() should fix #352644Daniel Veillard2006-10-161-0/+6
| | | | | | | * HTMLparser.c: remove a warning * encoding.c: check with uppercase for AIX iconv() should fix #352644 * doc/examples/Makefile.am: partially handle one bug report Daniel
* fixing bug #340398 xmlCharEncOutFunc writing to input buffer DanielDaniel Veillard2006-05-021-1/+2
| | | | | | * encoding.c: fixing bug #340398 xmlCharEncOutFunc writing to input buffer Daniel
* fix a few warning raised by gcc-4.1 and latests changes DanielDaniel Veillard2006-03-101-1/+0
| | | | | | * c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few warning raised by gcc-4.1 and latests changes Daniel
* more cleanups based on coverity reports. DanielDaniel Veillard2006-03-091-17/+9
| | | | | | * SAX2.c catalog.c encoding.c entities.c example/gjobread.c python/libxml.c: more cleanups based on coverity reports. Daniel
* avoid passing a char[] as snprintf first argument. implementedDaniel Veillard2005-09-021-3/+3
| | | | | | | | | * encoding.c parserInternals.c: avoid passing a char[] as snprintf first argument. * threads.c include/libxml/threads.h: implemented xmlIsThreadsEnabled() based on Andrew W. Nosenko idea. * doc/* elfgcchack.h: regenerated the API Daniel
* applied the patch suggested #309565 which can avoid looping in errorDaniel Veillard2005-08-241-1/+1
| | | | | | * encoding.c: applied the patch suggested #309565 which can avoid looping in error conditions. Daniel
* finally converted the encoding module to the common error reportingDaniel Veillard2005-08-241-32/+63
| | | | | | | * encoding.c error.c include/libxml/xmlerror.h: finally converted the encoding module to the common error reporting mechanism * doc/* doc/html/libxml-xmlerror.html: rebuilt Daniel
* a lot of small cleanups based on Linus' sparse check output. DanielDaniel Veillard2005-07-281-1/+1
| | | | | | | | | * HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c runsuite.c runtest.c schematron.c testHTML.c testReader.c testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of small cleanups based on Linus' sparse check output. Daniel
* revamped the elfgcchack.h format to cope with gcc4 change of aliasingDaniel Veillard2005-04-011-0/+2
| | | | | | | | | | | * doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h format to cope with gcc4 change of aliasing allowed scopes, had to add extra informations to doc/libxml2-api.xml to separate the header from the c module source. * *.c: updated all c library files to add a #define bottom_xxx and reimport elfgcchack.h thereafter, and a bit of cleanups. * doc//* testapi.c: regenerated when rebuilding the API Daniel
* fix unitinialized variable in not frequently used code bug #172182 DanielDaniel Veillard2005-03-311-1/+2
| | | | | | * encoding.c: fix unitinialized variable in not frequently used code bug #172182 Daniel
* removed a static buffer in xmlByteConsumed(), as pointed by Ben Maurer,Daniel Veillard2005-03-121-1/+1
| | | | | | | * encoding.c: removed a static buffer in xmlByteConsumed(), as pointed by Ben Maurer, fixes #170086 * xmlschemas.c: remove a potentially uninitialized pointer warning Daniel
* fix the comment to describe the real return values lot of work on theDaniel Veillard2005-02-161-2/+3
| | | | | | | | | | * encoding.c: fix the comment to describe the real return values * pattern.c xpath.c include/libxml/pattern.h: lot of work on the patterns, pluggin in the XPath default evaluation, but disabled right now because it's not yet good enough for XSLT. pattern.h streaming API are likely to be changed to handle relative and absolute paths in the same expression. Daniel
* forgot a $(srcdir) stupid error wrong name #157976 DanielDaniel Veillard2004-11-111-1/+1
| | | | | | * Makefile.am: forgot a $(srcdir) * encoding.c: stupid error wrong name #157976 Daniel
* fixed a regression in iconv support. DanielDaniel Veillard2004-11-061-2/+4
| | | | | * encoding.c: fixed a regression in iconv support. Daniel
* autogenerate a minimal NULL value sequence for unknown pointer types ThisDaniel Veillard2004-11-051-9/+30
| | | | | | | | | | | | * gentest.py testapi.c: autogenerate a minimal NULL value sequence for unknown pointer types * HTMLparser.c SAX2.c chvalid.c encoding.c entities.c parser.c parserInternals.c relaxng.c valid.c xmlIO.c xmlreader.c xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c xpath.c xpointer.c: This uncovered an impressive amount of entry points not checking for NULL pointers when they ought to, closing all the open gaps. Daniel
* Fixed bug #153937, making sure the conversion functions return the numberDaniel Veillard2004-10-311-11/+11
| | | | | | | * encoding.c doc/examples/testWriter.c: Fixed bug #153937, making sure the conversion functions return the number of byte written. Had to fix one of the examples. Daniel
* added the routine xmlNanoHTTPContentLength to the external APIWilliam M. Brack2004-09-181-1/+1
| | | | | | | | | | | | * nanohttp.c, include/libxml/nanohttp.h: added the routine xmlNanoHTTPContentLength to the external API (bug151968). * parser.c: fixed unnecessary internal error message (bug152060); also changed call to strncmp over to xmlStrncmp. * encoding.c: fixed compilation warning (bug152307). * tree.c: fixed segfault in xmlCopyPropList (bug152368); fixed a couple of compilation warnings. * HTMLtree.c, debugXML.c, xmlmemory.c: fixed a few compilation warnings; no change to logic.
* applied fixes for the UTF8ToISO8859x transcoding routine suggested by MarkWilliam M. Brack2004-09-091-5/+6
| | | | | * encoding.c: applied fixes for the UTF8ToISO8859x transcoding routine suggested by Mark Itzcovitz
* many further little changes for OOM problems. Now seems to be gettingWilliam M. Brack2004-07-311-0/+1
| | | | | | | | | * SAX2.c, encoding.c, error.c, parser.c, tree.c, uri.c, xmlIO.c, xmlreader.c, include/libxml/tree.h: many further little changes for OOM problems. Now seems to be getting closer to "ok". * testOOM.c: added code to intercept more errors, found more problems with library. Changed method of flagging / counting errors intercepted.
* small patch to try to fix a warning with Sun One compiler DanielDaniel Veillard2004-02-211-1/+1
| | | | | * encoding.c: small patch to try to fix a warning with Sun One compiler Daniel
* small patch removing a warning with MS compiler. DanielDaniel Veillard2004-02-211-1/+1
| | | | | * encoding.c: small patch removing a warning with MS compiler. Daniel
* added xmlByteConsumed() interface updated the benchmark rebuilt the docsDaniel Veillard2004-02-111-0/+75
| | | | | | | | | | * parserInternals.c xmlIO.c encoding.c include/libxml/parser.h include/libxml/xmlIO.h: added xmlByteConsumed() interface * doc/*: updated the benchmark rebuilt the docs * python/tests/Makefile.am python/tests/indexes.py: added a specific regression test for xmlByteConsumed() * include/libxml/encoding.h rngparser.c tree.c: small cleanups Daniel
* applied patch supplied by Christophe Dubach to fix problem withWilliam M. Brack2004-02-101-1/+1
| | | | | | | | * encoding.c: applied patch supplied by Christophe Dubach to fix problem with --with-minimum configuration (bug 133773) * nanoftp.c: fixed potential buffer overflow problem, similar to fix just applied to nanohttp.c.