diff options
author | Clément Bœsch <u@pkh.me> | 2017-03-19 17:54:08 +0100 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2017-03-19 17:55:06 +0100 |
commit | ca619cdf54caa75becf53d821258174cbbf85550 (patch) | |
tree | de3a784eb1837c1ca1c018947240104ef10ef307 | |
parent | 2da66630dce7a21b26bca8e47714a555bdb28a53 (diff) | |
parent | 221402c1c88b9d12130c6f5834029b535ee0e0c5 (diff) | |
download | ffmpeg-ca619cdf54caa75becf53d821258174cbbf85550.tar.gz |
Merge commit '221402c1c88b9d12130c6f5834029b535ee0e0c5'
* commit '221402c1c88b9d12130c6f5834029b535ee0e0c5':
pcx: check that the packet is large enough before reading the header
See 8cd1c0febe88b757e915e9af15559575c21ca728
Merged-by: Clément Bœsch <u@pkh.me>
-rw-r--r-- | libavcodec/pcx.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index 1d3ee8d96a..58a5e1e068 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -28,6 +28,8 @@ #include "get_bits.h" #include "internal.h" +#define PCX_HEADER_SIZE 128 + static void pcx_rle_decode(GetByteContext *gb, uint8_t *dst, unsigned int bytes_per_scanline, @@ -74,8 +76,10 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, bytes_per_scanline; uint8_t *ptr, *scanline; - if (avpkt->size < 128) + if (avpkt->size < PCX_HEADER_SIZE) { + av_log(avctx, AV_LOG_ERROR, "Packet too small\n"); return AVERROR_INVALIDDATA; + } bytestream2_init(&gb, avpkt->data, avpkt->size); |