* [FFmpeg-devel] [PATCH] avformat/mov: fix overflow in drift timestamp calculation
@ 2025-01-29 0:23 James Almer
2025-01-30 14:30 ` James Almer
0 siblings, 1 reply; 2+ messages in thread
From: James Almer @ 2025-01-29 0:23 UTC (permalink / raw)
To: ffmpeg-devel
Fixes: signed integer overflow: 7803923888585309955 - -3407677434275325337 cannot be represented in type 'int64_t' (aka 'long')
Fixes: 377736723/clusterfuzz-testcase-minimized-media_pipeline_integration_fuzzer-5052449500889088
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/mov.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index c016ce8e41..2c8be51063 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3541,7 +3541,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
current_dts += sc->stts_data[i].duration * (uint64_t)sample_count;
if (current_dts > corrected_dts) {
- int64_t drift = (current_dts - corrected_dts)/FFMAX(sample_count, 1);
+ int64_t drift = av_sat_sub64(current_dts, corrected_dts) / FFMAX(sample_count, 1);
uint32_t correction = (sc->stts_data[i].duration > drift) ? drift : sc->stts_data[i].duration - 1;
current_dts -= correction * (uint64_t)sample_count;
sc->stts_data[i].duration -= correction;
--
2.48.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mov: fix overflow in drift timestamp calculation
2025-01-29 0:23 [FFmpeg-devel] [PATCH] avformat/mov: fix overflow in drift timestamp calculation James Almer
@ 2025-01-30 14:30 ` James Almer
0 siblings, 0 replies; 2+ messages in thread
From: James Almer @ 2025-01-30 14:30 UTC (permalink / raw)
To: ffmpeg-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 1243 bytes --]
On 1/28/2025 9:23 PM, James Almer wrote:
> Fixes: signed integer overflow: 7803923888585309955 - -3407677434275325337 cannot be represented in type 'int64_t' (aka 'long')
> Fixes: 377736723/clusterfuzz-testcase-minimized-media_pipeline_integration_fuzzer-5052449500889088
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavformat/mov.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index c016ce8e41..2c8be51063 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -3541,7 +3541,7 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
> current_dts += sc->stts_data[i].duration * (uint64_t)sample_count;
>
> if (current_dts > corrected_dts) {
> - int64_t drift = (current_dts - corrected_dts)/FFMAX(sample_count, 1);
> + int64_t drift = av_sat_sub64(current_dts, corrected_dts) / FFMAX(sample_count, 1);
> uint32_t correction = (sc->stts_data[i].duration > drift) ? drift : sc->stts_data[i].duration - 1;
> current_dts -= correction * (uint64_t)sample_count;
> sc->stts_data[i].duration -= correction;
Will apply.
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-30 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-29 0:23 [FFmpeg-devel] [PATCH] avformat/mov: fix overflow in drift timestamp calculation James Almer
2025-01-30 14:30 ` James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git