summaryrefslogtreecommitdiff
path: root/libavcodec/truemotion1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-05 02:16:20 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-05 02:25:34 +0100
commit2b88cb2f4653e76ba58848ce2564a22501c9c4e9 (patch)
tree2095e077261618d87131996f1d9a09dba633697f /libavcodec/truemotion1.c
parentcd04f0da60bf7717ed34a6d30c7d36fff688b2de (diff)
parent2240e2078d53d3cfce8ff1dda64e58fa72038602 (diff)
Merge commit '2240e2078d53d3cfce8ff1dda64e58fa72038602'
* commit '2240e2078d53d3cfce8ff1dda64e58fa72038602': truemotion1: check the header size See: e7b43e8e84e48fccf64cdc62430cb8b5c69e804c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/truemotion1.c')
-rw-r--r--libavcodec/truemotion1.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index 6528a1f391..ed79959240 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -317,12 +317,17 @@ static int truemotion1_decode_header(TrueMotion1Context *s)
const uint8_t *sel_vector_table;
header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
- if (s->buf[0] < 0x10 || header.header_size >= s->size)
+ if (s->buf[0] < 0x10)
{
av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]);
return AVERROR_INVALIDDATA;
}
+ if (header.header_size + 1 > s->size) {
+ av_log(s->avctx, AV_LOG_ERROR, "Input packet too small.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
/* unscramble the header bytes with a XOR operation */
for (i = 1; i < header.header_size; i++)
header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];