From 0c5bb8a5e10657cec505729596c8b2f0c794cc8f Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Thu, 26 Jun 2025 22:20:46 +0100 Subject: Remove short read checks This removes a bunch of checks for cases where we _read_ less bytes than asked for. There are several reasons why we may _read_ less bytes including reading data from a network file system. This has proven to be an issue. Closes: https://github.com/nginx/nginx/issues/265 Signed-off-by: Andrew Clayton --- src/http/modules/ngx_http_geo_module.c | 7 ------- src/http/modules/ngx_http_mp4_module.c | 7 ------- 2 files changed, 14 deletions(-) (limited to 'src/http/modules') diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c index 75c03978a..ff3cd04d2 100644 --- a/src/http/modules/ngx_http_geo_module.c +++ b/src/http/modules/ngx_http_geo_module.c @@ -1486,13 +1486,6 @@ ngx_http_geo_include_binary_base(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, goto failed; } - if ((size_t) n != size) { - ngx_conf_log_error(NGX_LOG_CRIT, cf, 0, - ngx_read_file_n " \"%s\" returned only %z bytes instead of %z", - name->data, n, size); - goto failed; - } - header = (ngx_http_geo_header_t *) base; if (size < 16 || ngx_memcmp(&ngx_http_geo_header, header, 12) != 0) { diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index b7bd192df..3d998c250 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -1090,13 +1090,6 @@ ngx_http_mp4_read(ngx_http_mp4_file_t *mp4, size_t size) return NGX_ERROR; } - if ((size_t) n != mp4->buffer_size) { - ngx_log_error(NGX_LOG_CRIT, mp4->file.log, 0, - ngx_read_file_n " read only %z of %z from \"%s\"", - n, mp4->buffer_size, mp4->file.name.data); - return NGX_ERROR; - } - mp4->buffer_pos = mp4->buffer_start; mp4->buffer_end = mp4->buffer_start + mp4->buffer_size; -- cgit