mirror of
https://github.com/nginx/nginx.git
synced 2024-11-21 16:28:40 +00:00
Mp4: prevent chunk index underflow.
Some checks are pending
buildbot / buildbot (push) Waiting to run
Some checks are pending
buildbot / buildbot (push) Waiting to run
When cropping stsc atom, it's assumed that chunk index is never 0. Based on this assumption, start_chunk and end_chunk are calculated by subtracting 1 from it. If chunk index is zero, start_chunk or end_chunk may underflow, which will later trigger "start/end time is out mp4 stco chunks" error. The change adds an explicit check for zero chunk index to avoid underflow and report a proper error. Zero chunk index is explicitly banned in ISO/IEC 14496-12, 8.7.4 Sample To Chunk Box. It's also implicitly banned in QuickTime File Format specification. Description of chunk offset table references "Chunk 1" as the first table element.
This commit is contained in:
parent
d1a02451c3
commit
569948aa12
@ -3221,6 +3221,12 @@ found:
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
if (chunk == 0) {
|
||||
ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
|
||||
"zero chunk in \"%s\"", mp4->file.name.data);
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
target_chunk = chunk - 1;
|
||||
target_chunk += start_sample / samples;
|
||||
chunk_samples = start_sample % samples;
|
||||
|
Loading…
Reference in New Issue
Block a user