aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-15 16:48:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-21 20:43:39 +0200
commit71689e78632de55e593aa90ba2c80860c0b00eb6 (patch)
tree916793db42b9b2bda7c504b66e69dd171fa2ad5f
parentd2fbf8b5691fe3dc58137c06135fd44286f81f5e (diff)
downloadffmpeg-71689e78632de55e593aa90ba2c80860c0b00eb6.tar.gz
avcodec/shorten: Check skip_bytes()
Fixes CID1210526 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit d201becfc0d89c6a5dfe44e96f1044fbc2aadb70) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/shorten.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 925d9ca213..04e868fecd 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -369,6 +369,11 @@ static int read_header(ShortenContext *s)
s->nmean = get_uint(s, 0);
skip_bytes = get_uint(s, NSKIPSIZE);
+ if ((unsigned)skip_bytes > get_bits_left(&s->gb)/8) {
+ av_log(s->avctx, AV_LOG_ERROR, "invalid skip_bytes: %d\n", skip_bytes);
+ return AVERROR_INVALIDDATA;
+ }
+
for (i = 0; i < skip_bytes; i++)
skip_bits(&s->gb, 8);
}