Welcome! Log In Create A New Profile

Advanced

[nginx] Mp4: unordered stsc chunks error for the final chunk.

Anonymous User
November 21, 2024 07:10AM
details: https://github.com/nginx/nginx/commit/d1a02451c3c5767b5d0f23e138db98a9f7801335
branches: master
commit: d1a02451c3c5767b5d0f23e138db98a9f7801335
user: Roman Arutyunyan <arut@nginx.com>
date: Wed, 2 Oct 2024 16:22:15 +0400
description:
Mp4: unordered stsc chunks error for the final chunk.

Currently an error is triggered if any of the chunk runs in stsc are
unordered. This however does not include the final chunk run, which
ends with trak->chunks + 1. The previous chunk index can be larger
leading to a 32-bit overflow. This could allow to skip the validity
check "if (start_sample > n)". This could later lead to a large
trak->start_chunk/trak->end_chunk, which would be caught later in
ngx_http_mp4_update_stco_atom() or ngx_http_mp4_update_co64_atom().

While there are no implications of the validity check being avoided,
the change still adds a check to ensure the final chunk run is ordered,
to produce a meaningful error and avoid a potential integer overflow.

---
src/http/modules/ngx_http_mp4_module.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c
index 2ca059136..49b0999cf 100644
--- a/src/http/modules/ngx_http_mp4_module.c
+++ b/src/http/modules/ngx_http_mp4_module.c
@@ -3189,6 +3189,13 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4_file_t *mp4,

next_chunk = trak->chunks + 1;

+ if (next_chunk < chunk) {
+ ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
+ "unordered mp4 stsc chunks in \"%s\"",
+ mp4->file.name.data);
+ return NGX_ERROR;
+ }
+
ngx_log_debug4(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
"sample:%uD, chunk:%uD, chunks:%uD, samples:%uD",
start_sample, chunk, next_chunk - chunk, samples);
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Mp4: unordered stsc chunks error for the final chunk.

Anonymous User 130 November 21, 2024 07:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 211
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready