diff options
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/pcx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index d8b69b3b30..d024e4cd90 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -163,6 +163,12 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } else if (nplanes == 1 && bits_per_pixel == 8) { int palstart = avpkt->size - 769; + if (avpkt->size < 769) { + av_log(avctx, AV_LOG_ERROR, "File is too short\n"); + ret = avpkt->size; + goto end; + } + for (y = 0; y < h; y++, ptr += stride) { pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed); memcpy(ptr, scanline, w); |