tjko / jpeginfo

jpeginfo - prints information and tests integrity of JPEG/JFIF files
http://www.iki.fi/tjko/projects.html
GNU General Public License v3.0
139 stars 17 forks source link

A SIGKILL occurs while reading a JPEG file having a huge size of the pixel #8

Closed tank0123 closed 2 years ago

tank0123 commented 3 years ago

System Configuration

A SIGKILL interrupt occurs while reading the jpeg file. It causes while executing on the jpeg_start_decompress function of jpeginfo.c (364 line).

Printed messages:

Starting program: /home/server/analysis/jpeginfo/jpeginfo -c /home/server/jpeginfo_PoC Program terminated with signal SIGKILL, Killed.

This bug occurs when the libjpeg is processing image with abnormally large pixels. (This is similar to a bug that occurred with the jpegoptim. https://github.com/tjko/jpegoptim/issues/81)

It was not possible to obtain stack trace because the OS forcibly kills the process due to excessive memory allocation. It seems to occur while libjpeg is processing an abnormal jpeg file.

Therefore, for images with abnormally large pixels, error handling logic seems to be needed.

I've attached the file. Please download and check the file. jpeginfo_PoC.zip

tjko commented 2 years ago

Unable to reproduce the issue:

$ ./jpeginfo -c jpeginfo_PoC
jpeginfo_PoC 65280 x 65280 24bit JFIF  P    9871  Insufficient memory (case 11)  [ERROR]