[FFmpeg-cvslog] avcodec/rangecoder: Check e
Michael Niedermayer
git at videolan.org
Sun Dec 6 12:57:11 CET 2015
ffmpeg | branch: release/2.4 | Michael Niedermayer <michael at niedermayer.cc> | Fri Sep 25 14:26:14 2015 +0200| [b5b29b22c0f8b49db045edb33254291486cb0db7] | committer: Michael Niedermayer
avcodec/rangecoder: Check e
Fixes hang.nut
Found-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit b2955b6c5aed11026ec5c7164462899a10cdb937)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5b29b22c0f8b49db045edb33254291486cb0db7
---
libavcodec/ffv1dec.c | 5 ++++-
libavcodec/snow.h | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 760d74f..26ed2ee 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -47,8 +47,11 @@ static inline av_flatten int get_symbol_inline(RangeCoder *c, uint8_t *state,
else {
int i, e, a;
e = 0;
- while (get_rac(c, state + 1 + FFMIN(e, 9))) // 1..10
+ while (get_rac(c, state + 1 + FFMIN(e, 9))) { // 1..10
e++;
+ if (e > 31)
+ return AVERROR_INVALIDDATA;
+ }
a = 1;
for (i = e - 1; i >= 0; i--)
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 46df46c..d2fcc7c 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -555,6 +555,8 @@ static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){
e= 0;
while(get_rac(c, state+1 + FFMIN(e,9))){ //1..10
e++;
+ if (e > 31)
+ return AVERROR_INVALIDDATA;
}
a= 1;
More information about the ffmpeg-cvslog
mailing list