Skip to content
Snippets Groups Projects
Commit 9a53707e authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/pngdec: Fix paeth prediction with small images


Fixes out of array read
Fixes: asan_heap-oob_20b0a06_1962_cov_1907976991_delete_node_small.png
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: default avatarMichael Niedermayer <michaelni@gmx.at>
parent 79ceaf82
No related branches found
No related tags found
No related merge requests found
...@@ -267,8 +267,10 @@ static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, ...@@ -267,8 +267,10 @@ static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type,
/* would write off the end of the array if we let it process /* would write off the end of the array if we let it process
* the last pixel with bpp=3 */ * the last pixel with bpp=3 */
int w = bpp == 4 ? size : size - 3; int w = bpp == 4 ? size : size - 3;
dsp->add_paeth_prediction(dst + i, src + i, last + i, w - i, bpp); if (w > i) {
i = w; dsp->add_paeth_prediction(dst + i, src + i, last + i, w - i, bpp);
i = w;
}
} }
ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp);
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment