aboutsummaryrefslogtreecommitdiff
path: root/gst-libs/ext/libav/libavcodec/pcx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/ext/libav/libavcodec/pcx.c')
-rw-r--r--gst-libs/ext/libav/libavcodec/pcx.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gst-libs/ext/libav/libavcodec/pcx.c b/gst-libs/ext/libav/libavcodec/pcx.c
index ba3703a..223429d 100644
--- a/gst-libs/ext/libav/libavcodec/pcx.c
+++ b/gst-libs/ext/libav/libavcodec/pcx.c
@@ -184,7 +184,13 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} else if (nplanes == 1 && bits_per_pixel == 8) {
const uint8_t *palstart = bufstart + buf_size - 769;
- for (y=0; y<h; y++, ptr+=stride) {
+ if (buf_size < 769) {
+ av_log(avctx, AV_LOG_ERROR, "File is too short\n");
+ ret = buf_size;
+ goto end;
+ }
+
+ for (y = 0; y < h; y++, ptr += stride) {
buf = pcx_rle_decode(buf, buf_end,
scanline, bytes_per_scanline, compressed);
memcpy(ptr, scanline, w);
@@ -196,6 +202,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
if (*buf++ != 12) {
av_log(avctx, AV_LOG_ERROR, "expected palette after image data\n");
+ ret = buf_size;
goto end;
}