aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/ipmovie.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-12-18 23:46:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-12-18 23:46:37 +0100
commit4e575adeff316b351bc777a24d4b6beb5ac58cb2 (patch)
tree713abaacb3dbb310e75db8fb72ee05d60ad64eaf /libavformat/ipmovie.c
parent947e40b9feb8cd2817ce1bce0d2f6735b1144480 (diff)
downloadffmpeg-4e575adeff316b351bc777a24d4b6beb5ac58cb2.tar.gz
avformat/ipmovie: Check palette size in OPCODE_SET_PALETTE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/ipmovie.c')
-rw-r--r--libavformat/ipmovie.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 3c53686a6a..4a766ef3ba 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -465,7 +465,8 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
first_color = AV_RL16(&scratch[0]);
last_color = first_color + AV_RL16(&scratch[2]) - 1;
/* sanity check (since they are 16 bit values) */
- if ((first_color > 0xFF) || (last_color > 0xFF)) {
+ if ( (first_color > 0xFF) || (last_color > 0xFF)
+ || (last_color - first_color + 1)*3 + 4 > opcode_size) {
av_dlog(NULL, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n",
first_color, last_color);
chunk_type = CHUNK_BAD;