From 18a70a4d5806b5578d00460493954262ece55019 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Mon, 27 Apr 2026 09:40:16 +0400 Subject: [PATCH] Mp4: avoid adding or comparing to null pointer It is considered undefined behavior. Reported by Geonwoo.kim (awo@kakao.com). --- src/http/modules/ngx_http_mp4_module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index 678d6296c..0ccdf135a 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -1063,7 +1063,9 @@ ngx_http_mp4_read(ngx_http_mp4_file_t *mp4, size_t size) { ssize_t n; - if (mp4->buffer_pos + size <= mp4->buffer_end) { + if (mp4->buffer_pos && mp4->buffer_end + && mp4->buffer_pos + size <= mp4->buffer_end) + { return NGX_OK; } -- 2.47.3