diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-12 22:14:25 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-18 15:41:32 +0100 |
commit | fd165ace7b2791af75c74652364d47957d4ea932 (patch) | |
tree | f746cd2b386f5cea28217680c1473f3975932ca0 /libavcodec/golomb.h | |
parent | d084c5c742b6f325d3499e55872c54b90c5ce8ce (diff) | |
download | ffmpeg-fd165ace7b2791af75c74652364d47957d4ea932.tar.gz |
golomb: check log validity before shifting
Fixes invalid right shift in fate-cavs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/golomb.h')
-rw-r--r-- | libavcodec/golomb.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h index 0629c783de..9f82c74181 100644 --- a/libavcodec/golomb.h +++ b/libavcodec/golomb.h @@ -66,10 +66,14 @@ static inline int get_ue_golomb(GetBitContext *gb){ return ff_ue_golomb_vlc_code[buf]; }else{ log= 2*av_log2(buf) - 31; - buf>>= log; - buf--; LAST_SKIP_BITS(re, gb, 32 - log); CLOSE_READER(re, gb); + if (CONFIG_FTRAPV && log < 0) { + av_log(0, AV_LOG_ERROR, "Invalid UE golomb code\n"); + return AVERROR_INVALIDDATA; + } + buf>>= log; + buf--; return buf; } |