Originally reported via sparklemotion/nokogiri#2028
Reported upstream to libxml2 in https://gitlab.gnome.org/GNOME/libxml2/-/issues/192
To reproduce this issue:
- edit
Makefile
so that it knows where to find (and link) libxml2 - run
make
to generate the input documents and the executablerun-me
- run
run-me
Files:
run-me.c
- the source code!ok.xml
andfail.xml
(generated bymake inputs
) - example input documentsnokogiri-reproduction.rb
- reproduce this problem using Ruby and the Nokogiri gem
The documents ok.xml
and fail.xml
are identical except for byte 4001 which is a newline (0x0a
) in fail.xml
but is a "normal" ASCII character in ok.xml
. Parsing fail.xml
results in a fatal error "Huge input lookup" because xmlParseCharData
falls back unnecessarily to xmlParseCharDataComplex
.