mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Check for invalid maxval in pgm decoder, fixes issue 2518.
Patch by Daniel Kang, daniel.d.kang at gmail Originally committed as revision 26292 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
39f4d32908
commit
ebc3488300
@ -140,6 +140,10 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
|
||||
if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
|
||||
pnm_get(s, buf1, sizeof(buf1));
|
||||
s->maxval = atoi(buf1);
|
||||
if (s->maxval <= 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval);
|
||||
return -1;
|
||||
}
|
||||
if (s->maxval >= 256) {
|
||||
if (avctx->pix_fmt == PIX_FMT_GRAY8) {
|
||||
avctx->pix_fmt = PIX_FMT_GRAY16BE;
|
||||
|
Loading…
Reference in New Issue
Block a user