PR #25733 opened by DeVshaurya01
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25733
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25733.patch

Fixes: signed integer overflow: -9223372036854775808 - 32 cannot be represented 
in type int64_t

Signed-off-by: Shaurya Atram <[email protected]>

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 98210082327a57ac8f18d7e6a32bab83cad8be85 Mon Sep 17 00:00:00 2001
From: Shaurya Atram <[email protected]>
Date: Tue, 3 Nov 2026 15:18:26 +0000
Subject: [PATCH] avformat/mpc: avoid signed overflow in mpc_read_seek

Fixes: signed integer overflow: -9223372036854775808 - 32 cannot be represented 
in type int64_t

Signed-off-by: Shaurya Atram <[email protected]>
---
 libavformat/mpc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 45ba76c703f..8b1bf35e6da 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -192,11 +192,12 @@ static int mpc_read_seek(AVFormatContext *s, int 
stream_index, int64_t timestamp
     MPCContext *c = s->priv_data;
     AVPacket pkt1, *pkt = &pkt1;
     int ret;
-    int index = av_index_search_timestamp(st, FFMAX(timestamp - DELAY_FRAMES, 
0), flags);
+    int64_t seek_ts = av_sat_sub64(timestamp, DELAY_FRAMES);
+    int index = av_index_search_timestamp(st, FFMAX(seek_ts, 0), flags);
     uint32_t lastframe;
 
     /* if found, seek there */
-    if (index >= 0 && sti->index_entries[sti->nb_index_entries-1].timestamp >= 
timestamp - DELAY_FRAMES) {
+    if (index >= 0 && sti->index_entries[sti->nb_index_entries-1].timestamp >= 
seek_ts) {
         c->curframe = sti->index_entries[index].pos;
         return 0;
     }
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to