summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-30 01:46:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-30 01:49:21 +0200
commitc955bac7d5c1984dcb06539fe61844b7c09b72b4 (patch)
treeb3030c93c37a26b2b85e10ab05dcc4035e9deac0 /libavcodec
parent1eead877669b04a7f029001bfea8c8c3fd46763d (diff)
parentd1d99e3befea5d411ac3aae72dbdecce94f8b547 (diff)
downloadffmpeg-c955bac7d5c1984dcb06539fe61844b7c09b72b4.tar.gz
Merge commit 'd1d99e3befea5d411ac3aae72dbdecce94f8b547'
* commit 'd1d99e3befea5d411ac3aae72dbdecce94f8b547': pcx: Check the packet size before assuming it fits a palette Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pcx.c6
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);