Commit graph

35 commits

Author SHA1 Message Date
Sebastian Pipping
2b2a24691a Sync file headers 2025-03-27 17:45:25 +01:00
Sebastian Pipping
41fcb44549 lib/internal.h: Fix printf format specifiers for 32bit mode Emscripten
When compiling with Emscripten 3.1.6, the symptom was:
> [..]
> /usr/bin/emcc  @CMakeFiles/expat.dir/includes_C.rsp -fno-strict-aliasing -fvisibility=hidden -std=c99 -MD -MT CMakeFiles/expat.dir/lib/xmlparse.c.o -MF CMakeFiles/expat.dir/lib/xmlparse.c.o.d -o CMakeFiles/expat.dir/lib/xmlparse.c.o -c /libexpat/expat/lib/xmlparse.c
> /libexpat/expat/lib/xmlparse.c:8132:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
>           bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
>           ^~~~~~~~~
> 1 warning generated.
> [..]
> /usr/bin/emcc -DXML_TESTING @CMakeFiles/runtests.dir/includes_C.rsp -fno-strict-aliasing -fvisibility=hidden -std=c99 -MD -MT CMakeFiles/runtests.dir/tests/acc_tests.c.o -MF CMakeFiles/runtests.dir/tests/acc_tests.c.o.d -o CMakeFiles/runtests.dir/tests/acc_tests.c.o -c /libexpat/expat/tests/acc_tests.c
> /libexpat/expat/tests/acc_tests.c:279:11: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
>           u + 1, countCases, expectedCountBytesDirect, actualCountBytesDirect);
>           ^~~~~
> /libexpat/expat/tests/acc_tests.c:279:18: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
>           u + 1, countCases, expectedCountBytesDirect, actualCountBytesDirect);
>                  ^~~~~~~~~~
> /libexpat/expat/tests/acc_tests.c:288:11: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
>           u + 1, countCases, expectedCountBytesIndirect,
>           ^~~~~
> /libexpat/expat/tests/acc_tests.c:288:18: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
>           u + 1, countCases, expectedCountBytesIndirect,
>                  ^~~~~~~~~~
> 4 warnings generated.
> [..]
> /usr/bin/emcc -DXML_TESTING @CMakeFiles/runtests.dir/includes_C.rsp -fno-strict-aliasing -fvisibility=hidden -std=c99 -MD -MT CMakeFiles/runtests.dir/lib/xmlparse.c.o -MF CMakeFiles/runtests.dir/lib/xmlparse.c.o.d -o CMakeFiles/runtests.dir/lib/xmlparse.c.o -c /libexpat/expat/lib/xmlparse.c
> /libexpat/expat/lib/xmlparse.c:8132:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
>           bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
>           ^~~~~~~~~
> 1 warning generated.
> [..]
> /usr/bin/em++ -DXML_TESTING @CMakeFiles/runtests_cxx.dir/includes_CXX.rsp -fno-strict-aliasing -fvisibility=hidden -std=c++11 -MD -MT CMakeFiles/runtests_cxx.dir/tests/acc_tests_cxx.cpp.o -MF CMakeFiles/runtests_cxx.dir/tests/acc_tests_cxx.cpp.o.d -o CMakeFiles/runtests_cxx.dir/tests/acc_tests_cxx.cpp.o -c /libexpat/expat/tests/acc_tests_cxx.cpp
> In file included from /libexpat/expat/tests/acc_tests_cxx.cpp:32:
> /libexpat/expat/tests/acc_tests.c:279:11: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
>           u + 1, countCases, expectedCountBytesDirect, actualCountBytesDirect);
>           ^~~~~
> /libexpat/expat/tests/acc_tests.c:279:18: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
>           u + 1, countCases, expectedCountBytesDirect, actualCountBytesDirect);
>                  ^~~~~~~~~~
> /libexpat/expat/tests/acc_tests.c:288:11: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
>           u + 1, countCases, expectedCountBytesIndirect,
>           ^~~~~
> /libexpat/expat/tests/acc_tests.c:288:18: warning: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
>           u + 1, countCases, expectedCountBytesIndirect,
>                  ^~~~~~~~~~
> 4 warnings generated.
> [..]
> /usr/bin/emcc -DXML_TESTING @CMakeFiles/runtests_cxx.dir/includes_C.rsp -fno-strict-aliasing -fvisibility=hidden -std=c99 -MD -MT CMakeFiles/runtests_cxx.dir/lib/xmlparse.c.o -MF CMakeFiles/runtests_cxx.dir/lib/xmlparse.c.o.d -o CMakeFiles/runtests_cxx.dir/lib/xmlparse.c.o -c /libexpat/expat/lib/xmlparse.c
> /libexpat/expat/lib/xmlparse.c:8132:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
>           bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
>           ^~~~~~~~~
> 1 warning generated.
2025-03-17 03:49:10 +01:00
Sebastian Pipping
58ff7c39ea Sync file headers 2024-02-28 23:41:43 +01:00
Sebastian Pipping
7e2a0da9ba lib: Hide some test-only code behind new macro XML_TESTING 2024-02-21 13:07:35 +01:00
Snild Dolkow
fe0177cd3f tests: Replace g_parseAttempts with g_bytesScanned
This was used to estimate the number of scanned bytes. Just exposing
that number directly will be more precise.
2024-02-13 13:57:35 +01:00
Taichi Haradaguchi
3f60a47cb5 Fix compiler warnings
> In file included from ./../lib/internal.h:149,
>                  from codepage.c:38:
> ./../lib/expat.h:1045:5: warning: "XML_GE" is not defined, evaluates to 0 [-Wundef]
>  1045 | #if XML_GE == 1
>       |     ^~~~~~
> ./../lib/internal.h:158:5: warning: "XML_GE" is not defined, evaluates to 0 [-Wundef]
>   158 | #if XML_GE == 1
>       |     ^~~~~~
2024-02-10 23:08:03 +09:00
Sebastian Pipping
2a10e173ab Sync file headers 2024-02-06 14:13:00 +01:00
Snild Dolkow
8f8aaf5c8e tests: Check heuristic bypass with varying buffer fill sizes
The bypass works on the assumption that the application uses a
consistent fill size. Let's make some assertions about what should
happen when the application doesn't do that -- most importantly,
that parsing does happen eventually, and that the number of scanned
bytes doesn't explode.
2024-01-29 19:59:18 +01:00
Snild Dolkow
9fe3672459 tests: Run both with and without partial token heuristic
If we always run with the heuristic enabled, it may hide some bugs by
grouping up input into bigger parse attempts.

CI-fighting-assistance-by: Sebastian Pipping <sebastian@pipping.org>
2024-01-29 17:09:36 +01:00
Sebastian Pipping
caa2719863 Simplify "defined(XML_DTD) || XML_GE == 1" to "XML_GE == 1" 2023-11-07 13:00:42 +01:00
Sebastian Pipping
0f075ec8ec lib|xmlwf|cmake: Extend scope of billion laughs attack protection
.. from "defined(XML_DTD)" to "defined(XML_DTD) || XML_GE==1".
2023-11-06 20:43:09 +01:00
Sebastian Pipping
55b79f4d88 Sync file headers 2022-09-19 16:20:44 +02:00
Sebastian Pipping
446688c6ca lib: Fix compilation for -D__USE_MINGW_ANSI_STDIO=0 2022-08-27 23:37:04 +02:00
Sebastian Pipping
5dbc857f47 tests: Cover helper unsignedCharToPrintable 2021-05-07 18:25:08 +02:00
Sebastian Pipping
271efb6069 tests: Cover accounting 2021-05-07 18:25:07 +02:00
Sebastian Pipping
8af7d22ff0 lib: Allow test suite to access raw accounting values 2021-05-07 18:25:07 +02:00
Sebastian Pipping
b1d039607d lib: Protect against billion laughs attacks (approach 3.0.21) 2021-05-07 18:25:07 +02:00
Sebastian Pipping
df42f935bf Increase precision in existing MIT headers based on Git history 2021-05-02 19:53:29 +02:00
Sebastian Pipping
f29b48cfca Unexpose function _INTERNAL_trim_to_complete_utf8_characters (#457) 2021-04-05 21:44:15 +02:00
David Loffredo
561773607c handle unused parameters with the usual (void)param; statement rather than gcc-specific attribute
Signed-off-by: David Loffredo <loffredo@steptools.com>
2019-08-16 09:52:09 -04:00
clang-format
d248bbd940 Mass-apply clang-format 9 using ./apply-clang-format.sh 2019-08-03 21:31:44 +02:00
Sebastian Pipping
21e11f7782 internal.h: Fix UNUSED_P for GCC 3.3 (fixes #288) 2019-07-20 16:42:21 +02:00
Yury Gribov
30f8c30b6a Hide private symbols. 2018-09-20 17:45:01 +01:00
Sebastian Pipping
8711ee3054 Leave no doubt about align_limit_to_full_utf8_characters being internal 2017-08-23 17:41:17 +02:00
Sebastian Pipping
a704c940a4 Inline copyright headers with C/C++ code where missing (#116) 2017-08-12 21:02:41 +02:00
Sebastian Pipping
be917d9f84 Cover UTF-8 limit correction; some tests fail
Failing tests are:
[-] UTF-8 case  3: Expected movement by -1 chars, actually moved by  0 chars: "\xdf"
[-] UTF-8 case  4: Expected movement by  0 chars, actually moved by -1 chars: "\xdf\xbf"
[-] UTF-8 case  5: Expected movement by -1 chars, actually moved by  0 chars: "\xef"
[-] UTF-8 case  6: Expected movement by -2 chars, actually moved by -1 chars: "\xef\xbf"
[-] UTF-8 case  7: Expected movement by  0 chars, actually moved by -2 chars: "\xef\xbf\xbf"
[-] UTF-8 case  8: Expected movement by -1 chars, actually moved by  0 chars: "\xf7"
[-] UTF-8 case  9: Expected movement by -2 chars, actually moved by -1 chars: "\xf7\xbf"
[-] UTF-8 case 10: Expected movement by -3 chars, actually moved by -2 chars: "\xf7\xbf\xbf"
[-] UTF-8 case 11: Expected movement by  0 chars, actually moved by -3 chars: "\xf7\xbf\xbf\xbf"
2016-05-20 22:29:47 +02:00
Sebastian Pipping
69746f5ab2 Address all "unused parameter" warnings 2016-05-07 17:24:35 +02:00
Karl Waclawek
fd79deac8b Fix for bug #1548182 . 2006-11-26 17:35:37 +00:00
Greg Stein
d7a766e9df Suggested fix from jtalkington@users.sf.net.
See bug #765227.

* lib/internal.h:
  (FASTCALL, PTRFASTCALL): only define these macros for the GNU C compiler
    on i386 platforms. apprently, they do not work well on PPC ports.
2003-09-28 21:57:22 +00:00
Fred L. Drake, Jr.
f668c507d9 Be more defensive: only enable the *CALL macros when using GCC on
Linux, since we know the current definitions work there and have a
positive effect.
This closes SF bug #692878.
2003-03-14 17:25:12 +00:00
Fred L. Drake, Jr.
cc454566be Fix FASTCALL for GCC on Solaris (SF bug #692878).
This file is becoming a liability.
2003-03-12 23:02:11 +00:00
Karl Waclawek
5ca83cc911 Changed calling convention macros to differentiate between
different types of function calls - see comments in internal.h.
2002-09-20 03:42:43 +00:00
Fred L. Drake, Jr.
d784ead9cb A last-minute report suggests a problem with this using at least some
versions of egcs, so disable FASTCALL for GCC as well.  We are now not using
this for any platform.  ;-(
2002-09-06 21:49:57 +00:00
Fred L. Drake, Jr.
9bd525992b Disable FASTCALL on Windows since it turned out not to be as effective
as hoped.  Leaving the definition in the file so we'll know what it
was that didn't work, and hopefully find something better in the
future.
2002-09-06 21:29:46 +00:00
Fred L. Drake, Jr.
ca524b2c69 Added new header for common internal definitions. These are all performance-
related at the moment.
2002-09-05 01:56:29 +00:00