]> git.kaiwu.me - njs.git/commit
Fixed ‘length’ may be used uninitialized in Array.prototype.pop().
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 21 Jun 2024 00:26:14 +0000 (17:26 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Sat, 29 Jun 2024 02:52:19 +0000 (19:52 -0700)
commit1c2c7af35e5efe9ec32975467dfff7e4cc014afd
tree284f0b8601ed1bfcc52f26f1f6d2205f45a90b0d
parenta14be61c86db926c93645e929a79a960674b7715
Fixed ‘length’ may be used uninitialized in Array.prototype.pop().

When building by GCC with -O3 and -flto flags the following
warning was reported:
src/njs_array.c: In function ‘njs_array_prototype_pop’:
src/njs_array.c:1009:8: error: ‘length’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
1009 | if (length == 0) {
     |     ^

Returning a specific code in njs_value_to_number() helps GCC
to infer that there are only 2 return values are possible and
both of them are handled.
src/njs_value_conversion.h