check for number of scanlines read from jpeg to prevent integer underflow#12
check for number of scanlines read from jpeg to prevent integer underflow#12the-shank wants to merge 1 commit intoTalinx:masterfrom
Conversation
|
I don't think that this problem can occur here. According to the libjpeg-turbo docs Do you have an example that does not work currently but would with your code change? |
|
We found this as a part of our research study on Library API Misuse (handling of return values from library calls, etc.). We don't have a specific example available. As stated by you, |
jpeg_read_scanlines()can read less lines that requested in certain conditions (ref). When it returns without reading any rows, theoutput_scanlinecan be 0 (refer here). When this happens, it can lead to a integer underflow here.This patch adds check for the return value of
jpeg_read_scanlines()and in case the return value is 0, it just skips that loop and continues.