summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2018-04-07 00:34:25 +0200
committerMichael Niedermayer <[email protected]>2018-06-18 01:16:03 +0200
commitfffc77b472800a75eed147f8510ab52b87631256 (patch)
tree83385438e48f9785cee5aa5a79cfd3370f8514d1
parent0f868badcfdb40711e1158b863bfc66d97b028b8 (diff)
avcodec/h264_slice: Fix integer overflow with last_poc
Fixes: signed integer overflow: 2147483646 - -2816 cannot be represented in type 'int' Fixes: crbug 823145 Reported-by: Matt Wolenetz <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 8c02cd8ca097871dcd00cf8e08ce51660873f405) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/h264_slice.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index cf1b22fc32..f55cdf51f9 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1322,7 +1322,7 @@ static int h264_select_output_frame(H264Context *h)
}
out_of_order = MAX_DELAYED_PIC_COUNT - i;
if( cur->f->pict_type == AV_PICTURE_TYPE_B
- || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
+ || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - (int64_t)h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2))
out_of_order = FFMAX(out_of_order, 1);
if (out_of_order == MAX_DELAYED_PIC_COUNT) {
av_log(h->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]);