[njs] Fixed ‘ctx.codepoint’ may be used uninitialized.

noreply at nginx.com noreply at nginx.com
Sat Jun 29 02:53:05 UTC 2024


details:   https://hg.nginx.org/njs/rev/f358df45922c
branches:  
changeset: 2363:f358df45922c
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Jun 21 17:58:32 2024 -0700
description:
Fixed ‘ctx.codepoint’ may be used uninitialized.

When building by GCC 13 with -O3 and -flto flags the following
warning was reported:
In function ‘njs_utf8_decode’,
inlined from ‘njs_text_encoder_encode_into’ at
src/njs_encoding.c:214:14:
src/njs_utf8.c:191:42: error: ‘ctx.codepoint’ may be used
uninitialized [-Werror=maybe-uninitialized]
 191 |         ctx->codepoint = (ctx->codepoint << 6) | (c & 0x3F);

diffstat:

 src/njs_utf8.h |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 146d4699a4c4 -r f358df45922c src/njs_utf8.h
--- a/src/njs_utf8.h	Thu Jun 20 17:26:14 2024 -0700
+++ b/src/njs_utf8.h	Fri Jun 21 17:58:32 2024 -0700
@@ -128,6 +128,7 @@ njs_utf8_decode_init(njs_unicode_decode_
 {
     ctx->need = 0x00;
     ctx->lower = 0x00;
+    ctx->codepoint = 0;
 }
 
 


More information about the nginx-devel mailing list