mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
memory: Implement xmlGrowCapacity to safely grow arrays
xmlGrowCapacity makes sure that dynamic arrays don't grow beyond an explicit maximum size. size_t considerations are also taken into account. A macro XML_MAX_ITEMS is provided as default maximum with value 1 billion. When fuzzing, the initial size is set to 1 to cause more reallocations. This can require adjustments if callers really need larger arrays.
This commit is contained in:
12
libxml.h
12
libxml.h
@@ -29,6 +29,18 @@
|
||||
#include "config.h"
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#define XML_INLINE inline
|
||||
#elif defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1900
|
||||
#define XML_INLINE inline
|
||||
#else
|
||||
#define XML_INLINE _inline
|
||||
#endif
|
||||
#else
|
||||
#define XML_INLINE
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && \
|
||||
!defined(__CYGWIN__) && \
|
||||
(defined(__clang__) || \
|
||||
|
Reference in New Issue
Block a user