]> git.kaiwu.me - nginx.git/commit
Mp4: validate sync sample values in stss atom.
authorCodeByMoriarty <czyrabriones4@gmail.com>
Mon, 23 Feb 2026 00:45:47 +0000 (16:45 -0800)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Tue, 24 Mar 2026 18:33:23 +0000 (22:33 +0400)
commit4f0df130ba72982d34984f38d5007898765716b8
tree68ba242992fb762caf54794c0b669eba04964594
parent246c7444996fa1eafc9cee8bf06fe26fe892bb4a
Mp4: validate sync sample values in stss atom.

Per ISO 14496-12 Section 8.6.2, sync sample numbers must be 1-based.
A zero-valued stss entry caused ngx_http_mp4_seek_key_frame() to
return a key_prefix exceeding the samples consumed in the forward
stts pass, which led the backward loop in ngx_http_mp4_crop_stts_data()
to walk past the beginning of the stts data buffer.

The fix validates each stss entry in ngx_http_mp4_seek_key_frame()
and returns an error if a zero sync sample is encountered.  The
function signature is changed to return ngx_int_t so it can signal
errors to the caller.
src/http/modules/ngx_http_mp4_module.c