Stack overflow due to excessive stack consumption (Recursive function) #460
A stack overflow exits in
exiv2 0.27.0.0 (64 bit build)
./exiv2 -pi $POC
I have a patch (discussion below) and would like to ask @D4N to review and comment.
I believe this is a fuzzed CRW file. I don't know the specification for the CRW format, however it's a "kind of" tiff with directories and data. The code locates the directory and tests for sanity. However, the length of the directory is impossible (count == 17736). The whole buffer is 242 bytes, which has to include count*12 bytes for the directory.
I wondered if the test should include the size of the header, however this causes test/preview-test.sh to fail.
When I build with -DDEBUG, I get:
I've had another look at this. Several observations (and a new patch):