Skip to content

Commit

Permalink
Fix: SIGABRT while seeking when file has negative start time.
Browse files Browse the repository at this point in the history
Subtracting a negative start time from INT64_MAX results in an
integer overflow.

A negative start time can arise when a file has been cut from a
longer video file and reference frames prior to the cut point need
to be included in order to correctly decode the subsequent frames.

Thanks to: Joan Bruguera Mico <[email protected]>
Resolves: node/2296 (Seek doesn't work with negative start time)

git-svn-id: svn://svn.daper.net/moc/trunk@2996 910807d9-36e0-0310-a014-e9ea483e2ba4
  • Loading branch information
jcf committed Feb 27, 2019
1 parent a35dfa2 commit 00ea300
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decoder_plugins/ffmpeg/ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ static bool seek_in_stream (struct ffmpeg_data *data, int sec)
data->stream->time_base.num);

if (data->stream->start_time != (int64_t)AV_NOPTS_VALUE) {
if (seek_ts > INT64_MAX - data->stream->start_time) {
if (seek_ts > INT64_MAX - MAX(0, data->stream->start_time)) {
logit ("Seek value too large");
return false;
}
Expand Down

0 comments on commit 00ea300

Please sign in to comment.