Skip to content

Commit

Permalink
added check for negative track_id values (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwashiira committed Jun 5, 2024
1 parent 9565fe6 commit 7f8667d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tsMuxer/movDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ int MovDemuxer::mov_read_trun(MOVAtom atom)
MOVFragment* frag = &fragment;
unsigned data_offset = 0;

if (frag->track_id == 0 || frag->track_id > num_tracks)
if (frag->track_id <= 0 || frag->track_id > num_tracks)
return -1;
Track* st = tracks[frag->track_id - 1];
const auto sc = reinterpret_cast<MOVStreamContext*>(st);
Expand Down Expand Up @@ -1155,7 +1155,7 @@ int MovDemuxer::mov_read_tfhd(MOVAtom atom)
const int flags = get_be24();

const int track_id = static_cast<int>(get_be32());
if (!track_id || track_id > num_tracks)
if (track_id <= 0 || track_id > num_tracks)
return -1;
frag->track_id = track_id;
for (const auto& i : trex_data)
Expand Down

0 comments on commit 7f8667d

Please sign in to comment.