Skip to content

Commit

Permalink
avformat/mov: Break out early if chunk_count is 0 in mov_build_index()
Browse files Browse the repository at this point in the history
Without this some operations might overflow (undefined behavior)
even though the index adding loop would never execute

No testcase known

Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed May 20, 2018
1 parent fac5849 commit 56e76bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libavformat/mov.c
Original file line number Diff line number Diff line change
Expand Up @@ -3900,6 +3900,9 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
} else {
unsigned chunk_samples, total = 0;

if (!sc->chunk_count)
return;

// compute total chunk count
for (i = 0; i < sc->stsc_count; i++) {
unsigned count, chunk_count;
Expand Down

0 comments on commit 56e76bd

Please sign in to comment.