]> git.kaiwu.me - nginx.git/commitdiff
Mp4: fixed potential overflow in ngx_http_mp4_crop_stts_data().
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 7 Jun 2022 18:58:52 +0000 (21:58 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 7 Jun 2022 18:58:52 +0000 (21:58 +0300)
Both "count" and "duration" variables are 32-bit, so their product might
potentially overflow.  It is used to reduce 64-bit start_time variable,
and with very large start_time this can result in incorrect seeking.

Found by Coverity (CID 1499904).

src/http/modules/ngx_http_mp4_module.c

index 9c3f627fed77ecd469775b14cc5f37ca2f11fbd8..5721efbe609e6b74559c005de0d294f535c4634d 100644 (file)
@@ -2331,7 +2331,7 @@ ngx_http_mp4_crop_stts_data(ngx_http_mp4_file_t *mp4,
         }
 
         start_sample += count;
-        start_time -= count * duration;
+        start_time -= (uint64_t) count * duration;
         entries--;
         entry++;
     }