PR #22504 opened by James Almer (jamrial)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22504
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22504.patch

sc->sample_count and sc->sdtp_count are both unsigned ints.

Fixes Coverity issue CID 168634.


>From 31ab190070afe4a9302f24709d8a540a1ab1cd68 Mon Sep 17 00:00:00 2001
From: James Almer <[email protected]>
Date: Sat, 14 Mar 2026 15:15:07 -0300
Subject: [PATCH] avformat/mov: tighten sample count value in mov_read_sdtp

sc->sample_count and sc->sdtp_count are both unsigned ints.

Fixes Coverity issue CID 168634.

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9e1aca1b78..9cfba7d1c1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3680,7 +3680,8 @@ static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 {
     AVStream *st;
     MOVStreamContext *sc;
-    int64_t i, entries;
+    unsigned int i;
+    int64_t entries;
 
     if (c->fc->nb_streams < 1)
         return 0;
@@ -3699,7 +3700,7 @@ static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     av_freep(&sc->sdtp_data);
     sc->sdtp_count = 0;
 
-    if (entries < 0 || entries > SIZE_MAX)
+    if (entries < 0 || entries > UINT_MAX)
         return AVERROR(ERANGE);
 
     sc->sdtp_data = av_malloc(entries);
-- 
2.52.0

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

Reply via email to