From 7f8667d1e6100a5b6407340d91ad80d57d976e58 Mon Sep 17 00:00:00 2001 From: iwashiira <89283357+iwashiira@users.noreply.github.com> Date: Thu, 6 Jun 2024 03:13:25 +0900 Subject: [PATCH] added check for negative track_id values (#882) --- tsMuxer/movDemuxer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsMuxer/movDemuxer.cpp b/tsMuxer/movDemuxer.cpp index fb2d8c6c..864c6a57 100644 --- a/tsMuxer/movDemuxer.cpp +++ b/tsMuxer/movDemuxer.cpp @@ -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(st); @@ -1155,7 +1155,7 @@ int MovDemuxer::mov_read_tfhd(MOVAtom atom) const int flags = get_be24(); const int track_id = static_cast(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)