]> git.kaiwu.me - nginx.git/commitdiff
Merge of r5098: mp4: fixed handling of too small mdat atoms.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 29 Mar 2013 17:20:59 +0000 (17:20 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 29 Mar 2013 17:20:59 +0000 (17:20 +0000)
Mp4: fixed handling of too small mdat atoms (ticket #266).

Patch by Gernot Vormayr (with minor changes).

src/http/modules/ngx_http_mp4_module.c

index d3be23420e662685e8506d5c40d6e02250a1a06a..e793f77b7fd0e3979b27ac01f522dc51069d81ba 100644 (file)
@@ -750,6 +750,13 @@ ngx_http_mp4_process(ngx_http_mp4_file_t *mp4)
 
     *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;