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

58 Commits

Author SHA1 Message Date
Nick Wellnhofer
5d36664fc9 memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
Nick Wellnhofer
886c427ab7 c14n: Move some static xmlNs variables to the stack
Static variables aren't thread-safe.
2024-06-12 16:36:12 +02:00
Nick Wellnhofer
0bef170486 c14n: Fix memory leak after malloc failure 2024-05-07 17:11:18 +02:00
Nick Wellnhofer
e314109ad1 save: Don't write directly to internal buffer
Make sure that OOM errors are reported.
2024-02-16 16:14:05 +01:00
Nick Wellnhofer
921ab01ea7 c14n: Improve error handling
Stop raising meaningless internal errors.
2024-02-04 14:33:19 +01:00
Nick Wellnhofer
25e22011db c14n: Improve error handling
Handle malloc failure from xmlRaiseError.

Add context argument to error functions.

Remove argument from memory error handler.

Use xmlRaiseMemoryError.
2023-12-21 02:46:27 +01:00
makise-homura
873c171165 Avoid EDG -Wignored-qualifiers warnings on wrong 'const *' to '* const' conversions 2023-11-22 05:34:56 +00:00
Nick Wellnhofer
699299cae3 globals: Stop including globals.h 2023-09-20 22:07:40 +02:00
Nick Wellnhofer
14d38a7114 Don't build unneeded .c source files 2022-09-02 18:33:35 +02:00
Nick Wellnhofer
2cac626976 Don't use sizeof(xmlChar) or sizeof(char) 2022-09-01 03:35:19 +02:00
Nick Wellnhofer
ad338ca737 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.
2022-09-01 02:33:57 +02:00
Nick Wellnhofer
0f568c0b73 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.
2022-08-26 02:11:56 +02:00
Nick Wellnhofer
4a8c71eb7c 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.
2022-03-04 22:56:21 +01:00
Nick Wellnhofer
776d15d383 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
2022-03-02 00:43:54 +01:00
Nick Wellnhofer
346c3a930c Remove elfgcchack.h
The same optimization can be enabled with -fno-semantic-interposition
since GCC 5. clang has always used this option by default.
2022-02-20 21:49:04 +01:00
Nick Wellnhofer
84bab955fe Fix return value of xmlC14NDocDumpMemory
Make sure to return -1 in case of buffer errors.

Fixes #174.
2020-06-24 20:07:32 +02:00
Nick Wellnhofer
20c60886e4 Fix typos
Resolves #133.
2020-03-08 17:41:53 +01:00
Jared Yanovich
2a350ee9b4 Large batch of typo fixes
Closes #109.
2019-09-30 18:04:38 +02:00
Nick Wellnhofer
ee501f5449 Stop using doc->charset outside parser code
doc->charset does not specify the in-memory encoding which is always
UTF-8.
2018-10-13 16:47:01 +02:00
Nick Wellnhofer
cb5541c9f3 Fix libz and liblzma detection
If libz or liblzma are detected with pkg-config, AC_CHECK_HEADERS must
not be run because the correct CPPFLAGS aren't set. It is actually not
required have separate checks for LIBXML_ZLIB_ENABLED and HAVE_ZLIB_H.
Only check for LIBXML_ZLIB_ENABLED and remove HAVE_ZLIB_H macro.

Fixes bug 764657, bug 787041.
2017-11-27 14:33:37 +01:00
Nick Wellnhofer
e5f33e56ba Fix misc callback signatures
Fix parameter and return types for xmlC14NIsVisibleCallback and
xmlRegExecCallbacks.
2017-11-09 17:29:22 +01:00
Nick Wellnhofer
4dd6d7a58e 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 *`.
2017-11-09 17:28:00 +01:00
Nick Wellnhofer
3939178e4c Treat URIs with scheme as absolute in C14N
Fixes bug 783656.
2017-06-12 20:19:02 +02:00
Aleksey Sanin
1ba80b7b6f properly quote the namespace uris written out during c14n 2013-05-09 16:02:16 +00:00
Daniel Veillard
f8e3db0445 Big space and tab cleanup
Remove all space before tabs and space and tabs at end of lines.
2012-09-11 13:26:36 +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
13cee4e37b Fix a bunch of scan 'dead increments' and cleanup
* HTMLparser.c c14n.c debugXML.c entities.c nanohttp.c parser.c
  testC14N.c uri.c xmlcatalog.c xmllint.c xmlregexp.c xpath.c:
  fix unused variables, or unneeded increments as well as a couple
  of space issues
* runtest.c: check for NULL before calling unlink()
2009-09-05 14:52:55 +02:00
Aleksey Sanin
175beba061 Fix a couple of ABI issues with C14N 1.1
* include/libxml/c14n.h c14n.c: fix API to not include enum xmlC14NMode
  in the arguments, and do a bit more check on input
2009-07-09 22:54:00 +02:00
Aleksey Sanin
838682478c Aleksey Sanin support for c14n 1.1
* c14n.c include/libxml/c14n.h: adds support for C14N 1.1,
  new flags at the API level
* runtest.c Makefile.am testC14N.c xmllint.c: add support in CLI
  tools and test binaries
* result/c14n/1-1-without-comments/* test/c14n/1-1-without-comments/*:
  add a new batch of tests
2009-07-09 10:26:22 +02:00
Daniel Veillard
bccae2d210 * 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
2009-06-04 11:22:45 +02:00
Daniel Veillard
aac7c68e87 fix a few warning raised by gcc-4.1 and latests changes Daniel
* c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few
  warning raised by gcc-4.1 and latests changes
Daniel
2006-03-10 13:40:16 +00:00
Aleksey Sanin
b2eabc0c44 fixed bug in exc-c14n namespace visibility + test case 319367(bug #319367) 2005-10-28 03:15:18 +00:00
Aleksey Sanin
3ea201cedb fixing rendering of attributes when parent node is not in the node set 2005-06-07 16:53:57 +00:00
Aleksey Sanin
2650df1a68 fixed xml attributes processing bug in exc c14n added --exc-c14n command
* c14n.c: fixed xml attributes processing bug in exc c14n
* xmllint.c: added --exc-c14n command line option
2005-06-06 17:16:50 +00:00
Daniel Veillard
5d4644ef6e revamped the elfgcchack.h format to cope with gcc4 change of aliasing
* 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
2005-04-01 13:11:58 +00:00
Aleksey Sanin
9e75e9fe95 special case "DAV:" namespace in c14n relative namespaces check and add
* c14n.c include/libxml/xmlerror.h: special case "DAV:" namespace
in c14n relative namespaces check and add structured error messages
to c14n code
2005-03-20 19:16:47 +00:00
Aleksey Sanin
64453bc681 fixed c14n bug with serializing attribute namespaces 2004-05-25 17:39:48 +00:00
Aleksey Sanin
6de6f97d19 fixing C14N bug with processing namespaces from attributes 2004-04-20 02:05:30 +00:00
Daniel Veillard
659e71ec24 Setting up the framework for structured error reporting, touches a lot of
* HTMLparser.c c14n.c catalog.c error.c globals.c parser.c
  parserInternals.c relaxng.c valid.c xinclude.c xmlIO.c xmlregexp.c
  xmlschemas.c xpath.c xpointer.c include/libxml/globals.h
  include/libxml/parser.h include/libxml/valid.h
  include/libxml/xmlerror.h: Setting up the framework for structured
  error reporting, touches a lot of modules, but little code now
  the error handling trail has been cleaned up.
Daniel
2003-10-10 14:10:40 +00:00
Daniel Veillard
d96cce1abe converted the C14N module too Daniel
* c14n.c include/libxml/xmlerror.h: converted the C14N module too
Daniel
2003-10-10 12:30:37 +00:00
Daniel Veillard
a9cce9cd0d Okay this is scary but it is just adding a configure option to disable
* HTMLtree.c SAX2.c c14n.c catalog.c configure.in debugXML.c
  encoding.c entities.c nanoftp.c nanohttp.c parser.c relaxng.c
  testAutomata.c testC14N.c testHTML.c testRegexp.c testRelax.c
  testSchemas.c testXPath.c threads.c tree.c valid.c xmlIO.c
  xmlcatalog.c xmllint.c xmlmemory.c xmlreader.c xmlschemas.c
  example/gjobread.c include/libxml/HTMLtree.h include/libxml/c14n.h
  include/libxml/catalog.h include/libxml/debugXML.h
  include/libxml/entities.h include/libxml/nanohttp.h
  include/libxml/relaxng.h include/libxml/tree.h
  include/libxml/valid.h include/libxml/xmlIO.h
  include/libxml/xmlschemas.h include/libxml/xmlversion.h.in
  include/libxml/xpathInternals.h python/libxml.c:
  Okay this is scary but it is just adding a configure option
  to disable output, this touches most of the files.
Daniel
2003-09-29 13:20:24 +00:00
Daniel Veillard
3c908dca47 added xmlMallocAtomic() to be used when allocating blocks which do not
* DOCBparser.c HTMLparser.c c14n.c catalog.c encoding.c globals.c
  nanohttp.c parser.c parserInternals.c relaxng.c tree.c uri.c
  xmlmemory.c xmlreader.c xmlregexp.c xpath.c xpointer.c
  include/libxml/globals.h include/libxml/xmlmemory.h: added
  xmlMallocAtomic() to be used when allocating blocks which
  do not contains pointers, add xmlGcMemSetup() and xmlGcMemGet()
  to allow registering the full set of functions needed by
  a garbage collecting allocator like libgc, ref #109944
Daniel
2003-04-19 00:07:51 +00:00
Daniel Veillard
01c13b5be2 code cleanup, especially the function comments. fixed a small bug when
* DOCBparser.c HTMLparser.c c14n.c debugXML.c encoding.c hash.c
  nanoftp.c nanohttp.c parser.c parserInternals.c testC14N.c
  testDocbook.c threads.c tree.c valid.c xmlIO.c xmllint.c xmlmemory.c
  xmlreader.c xmlregexp.c xmlschemas.c xmlschemastypes.c xpath.c:
  code cleanup, especially the function comments.
* tree.c: fixed a small bug when freeing nodes which are XInclude ones.
Daniel
2002-12-10 15:19:08 +00:00
Daniel Veillard
3487c8d9bb get rid of all the perror() calls made in the library execution paths.
* DOCBparser.c HTMLparser.c c14n.c entities.c list.c
  parser.c parserInternals.c xmlIO.c: get rid of all the
  perror() calls made in the library execution paths. This
  should fix both #92059 and #92385
Daniel
2002-09-05 11:33:25 +00:00
Aleksey Sanin
ea4272a199 fixed memory leak in c14n code
* c14n.c: fixed memory leak in c14n code
2002-08-02 23:50:03 +00:00
Aleksey Sanin
2c135a1cf1 fixed one more c14n + namespaces corner case from new Merlin's test suite
* c14n.c include/libxml/c14n.h: fixed one more c14n + namespaces                corner case from new Merlin's test suite and added a callback                   that will be used to improve xmlsec performance
2002-08-01 06:31:50 +00:00
Aleksey Sanin
f8cb6dda89 added merlin-c14n-two.tar.gz tests for c14n/exc-c14n and slightly modified
* result/c14n/exc-without-comments/merlin-c14n-two-*
  result/c14n/without-comments/merlin-c14n-two-*
  test/c14n/exc-without-comments/merlin-c14n-two-*
  test/c14n/without-comments/merlin-c14n-two-*
  testC14N.c Makefile.am: added merlin-c14n-two.tar.gz tests for
c14n/exc-c14n and slightly modified test script to handle
these test cases
* c14n.c: fixed bugs for complicated nodes set (namespace
without node and others from merlin-c14n-two.tar.gz)
* include/libxml/xpathInternals.h win32/dsp/libxml2.def.src
win32/libxml2.def.src: "opened" xmlXPathNodeSetFreeNs() function
for xmlsec performance patch
* xpath.c: fixed self::node() for namespaces and attributes
2002-06-04 04:27:06 +00:00
Aleksey Sanin
c57f9c1210 Makefile.am: updated c14n tests suite
c14n.c: performance improvement for previous c14n patch
2002-05-31 19:14:57 +00:00
Aleksey Sanin
dffd5c8dbc propagating xpath ancesstors node fix to c14n plus small performance
* c14n.c: propagating xpath ancesstors node fix to c14n                         plus small performance improvement to reduce number of                          mallocs                                                                         * xpath.c: fixed ancestors axis processing for namespace nodes
2002-05-31 04:24:13 +00:00
Daniel Veillard
547611303e patch from Aleksey Sanin reflecting a change in the ExcC14N specification
* c14n.c: patch from Aleksey Sanin reflecting a change in the
  ExcC14N specification
Daniel
2002-04-18 21:00:44 +00:00