summaryrefslogtreecommitdiff
path: root/libavcodec/dts2pts_bsf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-11-21 23:59:49 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-11-28 20:58:06 +0100
commit5185d5656b5fc37541606a804f831e08e434baab (patch)
treed6a199618f5710b26c5280b834e17a38a63e2495 /libavcodec/dts2pts_bsf.c
parentaa79560de5e9596ada0345e5d12aa00dbeddaaa6 (diff)
downloadffmpeg-5185d5656b5fc37541606a804f831e08e434baab.tar.gz
avcodec/dts2pts_bsf: Eliminate some 64bit corner cases
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 53364/clusterfuzz-testcase-minimized-ffmpeg_BSF_DTS2PTS_fuzzer-4693772269387776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dts2pts_bsf.c')
-rw-r--r--libavcodec/dts2pts_bsf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/dts2pts_bsf.c b/libavcodec/dts2pts_bsf.c
index 8142562d2c..522d5e1eb0 100644
--- a/libavcodec/dts2pts_bsf.c
+++ b/libavcodec/dts2pts_bsf.c
@@ -301,15 +301,15 @@ static int h264_filter(AVBSFContext *ctx)
if (output_picture_number != h264->last_poc) {
if (h264->last_poc != INT_MIN) {
- int diff = FFABS(h264->last_poc - output_picture_number);
+ int64_t diff = FFABS(h264->last_poc - (int64_t)output_picture_number);
if ((output_picture_number < 0) && !h264->last_poc)
h264->poc_diff = 0;
- else if (FFABS(output_picture_number) < h264->poc_diff) {
+ else if (FFABS((int64_t)output_picture_number) < h264->poc_diff) {
diff = FFABS(output_picture_number);
h264->poc_diff = 0;
}
- if (!h264->poc_diff || (h264->poc_diff > diff)) {
+ if ((!h264->poc_diff || (h264->poc_diff > diff)) && diff <= INT_MAX) {
h264->poc_diff = diff;
if (h264->poc_diff == 1 && h264->sps.frame_mbs_only_flag) {
av_tree_enumerate(s->root, &h264->poc_diff, NULL, dec_poc);