]> git.kaiwu.me - nginx.git/commit
Mp4: unordered stsc chunks error for the final chunk.
authorRoman Arutyunyan <arut@nginx.com>
Wed, 2 Oct 2024 12:22:15 +0000 (16:22 +0400)
committerpluknet <pluknet@nginx.com>
Wed, 5 Feb 2025 16:40:47 +0000 (20:40 +0400)
commit1ebe58a02e90a65458de0a38c84165b2a37574ed
treec305de610af54b8202d9f39bbd3e80466e59b2dd
parent4712dee8820cf6af417b1932d9ef65774a1ee1b3
Mp4: unordered stsc chunks error for the final chunk.

Currently an error is triggered if any of the chunk runs in stsc are
unordered.  This however does not include the final chunk run, which
ends with trak->chunks + 1.  The previous chunk index can be larger
leading to a 32-bit overflow.  This could allow to skip the validity
check "if (start_sample > n)".  This could later lead to a large
trak->start_chunk/trak->end_chunk, which would be caught later in
ngx_http_mp4_update_stco_atom() or ngx_http_mp4_update_co64_atom().

While there are no implications of the validity check being avoided,
the change still adds a check to ensure the final chunk run is ordered,
to produce a meaningful error and avoid a potential integer overflow.
src/http/modules/ngx_http_mp4_module.c