avcodec/h264_direct: Check CO-POCs before use
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 3 Dec 2015 23:31:44 +0000 (00:31 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 4 Dec 2015 00:55:11 +0000 (01:55 +0100)
Fixes harmless integer overflow
Fixes mozilla bug 1230286

Found-by: Tyson Smith
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/h264_direct.c

index 5756a7b..5f66a67 100644 (file)
@@ -137,6 +137,10 @@ void ff_h264_direct_ref_list_init(const H264Context *const h, H264SliceContext *
     if (h->picture_structure == PICT_FRAME) {
         int cur_poc  = h->cur_pic_ptr->poc;
         int *col_poc = sl->ref_list[1][0].parent->field_poc;
+        if (col_poc[0] == INT_MAX && col_poc[1] == INT_MAX) {
+            av_log(h->avctx, AV_LOG_ERROR, "co located POCs unavailable\n");
+            sl->col_parity = 1;
+        } else
         sl->col_parity = (FFABS(col_poc[0] - cur_poc) >=
                           FFABS(col_poc[1] - cur_poc));
         ref1sidx =