[FFmpeg-cvslog] avcodec/hevc: Print an error if luma_log2_weight_denom is out of range

Michael Niedermayer git at videolan.org
Mon Dec 15 21:19:19 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Dec 15 21:10:23 2014 +0100| [b799ec7e0b346afd6cd8c44d407e3c49d9db6692] | committer: Michael Niedermayer

avcodec/hevc: Print an error if luma_log2_weight_denom is out of range

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 2dccfc1..68ab295 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -143,8 +143,12 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb)
     uint8_t chroma_weight_l0_flag[16];
     uint8_t luma_weight_l1_flag[16];
     uint8_t chroma_weight_l1_flag[16];
+    int luma_log2_weight_denom;
 
-    s->sh.luma_log2_weight_denom = av_clip_c(get_ue_golomb_long(gb), 0, 7);
+    luma_log2_weight_denom = get_ue_golomb_long(gb);
+    if (luma_log2_weight_denom < 0 || luma_log2_weight_denom > 7)
+        av_log(s->avctx, AV_LOG_ERROR, "luma_log2_weight_denom %d is invalid\n", luma_log2_weight_denom);
+    s->sh.luma_log2_weight_denom = av_clip_c(luma_log2_weight_denom, 0, 7);
     if (s->sps->chroma_format_idc != 0) {
         int delta = get_se_golomb(gb);
         s->sh.chroma_log2_weight_denom = av_clip(s->sh.luma_log2_weight_denom + delta, 0, 7);



More information about the ffmpeg-cvslog mailing list