You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JPEG qtables iteration failure causes a NULL dereference in Image.save() #9917
Image.save() first validates the JPEG qtables sequence and then reads it again during encoding.
If the sequence raises an exception when it is read again, Pillow crashes instead of propagating the exception.
An ASan/UBSan build reports a null-pointer read in get_qtables_arrays() at src/encode.c:1131:
/usr/include/python3.12/object.h:220:16: runtime error:
member access within null pointer of type 'PyObject'
AddressSanitizer: SEGV on unknown address 0x000000000008
The signal is caused by a READ memory access.
#0 Py_TYPE object.h:220:16
#1 get_qtables_arrays src/encode.c:1131:17
#2 PyImaging_JpegEncoderNew src/encode.c:1234:15
I found this while fuzzing Python C extension modules for a small research project.
Activity