Describe the bug
Hallo :wave:. I have found an integer wraparound bug in pdfio-value.c; _pdfioValueRead; line 388. If v->value.binary.datalen < ivlen, the arithmetic operation will cause the len parameter passed to _pdfioCryptoAESDecrypt to overflow/underflow as size_t is typically and unsigned integer https://en.wikipedia.org/wiki/C_data_types#stddef.h.
There are a few ways to prevent this but the simplest way would be to check if v->value.binary.datalen >= ivlen (granted, I've never been a software engineer so take this with a grain of salt).
To Reproduce
The following pdf triggers the bug - bad.pdf
Follow up: In pdfio-aes.c; when _pdfioCryptoAESDecrypt is called by _pdfioValueRead, if inbuffer != outbuffer, then a memcpy will execute leading to a heap overflow.
Describe the bug Hallo :wave:. I have found an integer wraparound bug in
pdfio-value.c
;_pdfioValueRead
; line 388. Ifv->value.binary.datalen
<ivlen
, the arithmetic operation will cause thelen
parameter passed to_pdfioCryptoAESDecrypt
to overflow/underflow assize_t
is typically and unsigned integer https://en.wikipedia.org/wiki/C_data_types#stddef.h.There are a few ways to prevent this but the simplest way would be to check if
v->value.binary.datalen
>=ivlen
(granted, I've never been a software engineer so take this with a grain of salt).To Reproduce The following pdf triggers the bug - bad.pdf
Expected behavior
pdfiototext
should be able to gracefully exit if this occurs.System Information:
Additional context Cheers mate :wine_glass: