1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-19 05:49:09 +02:00

avformat/mov: Check requested_sample before using it

I am not sure the case described by coverity is possible
but its more robust checking the argument first

Fixes: CID1598441 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-06-06 23:24:44 +02:00
parent a469e48b6d
commit 64df7d4c1e
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -10486,7 +10486,7 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp,
// If we've reached a different sample trying to find a good pts to
// seek to, give up searching because we'll end up seeking back to
// sample 0 on every seek.
if (!can_seek_to_key_sample(st, requested_sample, next_ts) && sample != requested_sample)
if (sample != requested_sample && !can_seek_to_key_sample(st, requested_sample, next_ts))
break;
timestamp = next_ts;