[FFmpeg-cvslog] avcodec/h264_parse: Clear invalid chroma weights in ff_h264_pred_weight_table()

Michael Niedermayer git at videolan.org
Tue Feb 20 19:01:19 EET 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Feb 18 17:12:28 2018 +0100| [85c85fffff3f9c75301db3eba1bd5f2fb1e6285d] | committer: Michael Niedermayer

avcodec/h264_parse: Clear invalid chroma weights in ff_h264_pred_weight_table()

Fixes: 6037/clusterfuzz-testcase-minimized-5030249784934400
Fixes: signed integer overflow: 256 * 16992036 cannot be represented in type 'int'

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85c85fffff3f9c75301db3eba1bd5f2fb1e6285d
---

 libavcodec/h264_parse.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c
index 6cbef5a13d..87e5b3cdc5 100644
--- a/libavcodec/h264_parse.c
+++ b/libavcodec/h264_parse.c
@@ -82,8 +82,11 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps,
                         pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb);
                         pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb);
                         if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] ||
-                            (int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1])
+                            (int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) {
+                            pwt->chroma_weight[i][list][j][0] = chroma_def;
+                            pwt->chroma_weight[i][list][j][1] = 0;
                             goto out_range_weight;
+                        }
                         if (pwt->chroma_weight[i][list][j][0] != chroma_def ||
                             pwt->chroma_weight[i][list][j][1] != 0) {
                             pwt->use_weight_chroma        = 1;



More information about the ffmpeg-cvslog mailing list