# HG changeset patch # User Maxim Dounin # Date 1362411543 0 # Node ID 37671d0042b7493fbeefbd2e974f0121bffff4a2 # Parent 63014d919fec96886fedb5e7c330e1ffdc5a84cc Mp4: fixed handling of too small mdat atoms (ticket #266). Patch by Gernot Vormayr (with minor changes). diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -754,6 +754,13 @@ ngx_http_mp4_process(ngx_http_mp4_file_t *prev = &mp4->mdat_atom; + if (start_offset > mp4->mdat_data.buf->file_last) { + ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, + "start time is out mp4 mdat atom in \"%s\"", + mp4->file.name.data); + return NGX_ERROR; + } + adjustment = mp4->ftyp_size + mp4->moov_size + ngx_http_mp4_update_mdat_atom(mp4, start_offset) - start_offset;