Welcome! Log In Create A New Profile

Advanced

[njs] Fixed use-of-uninitialized-value after 1d0825906438.

Dmitry Volyntsev
May 27, 2020 09:42AM
details: https://hg.nginx.org/njs/rev/4fb07fcbb698
branches:
changeset: 1404:4fb07fcbb698
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Wed May 27 12:02:59 2020 +0000
description:
Fixed use-of-uninitialized-value after 1d0825906438.

Found by Coverity (CID 1463834).

diffstat:

src/njs_array.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 1b8a0af35e2b -r 4fb07fcbb698 src/njs_array.c
--- a/src/njs_array.c Tue May 26 19:03:11 2020 +0000
+++ b/src/njs_array.c Wed May 27 12:02:59 2020 +0000
@@ -3254,7 +3254,10 @@ njs_array_prototype_sort(njs_vm_t *vm, n
return NJS_OK;
}

+ slots = NULL;
ctx.vm = vm;
+ ctx.strings.separate = 0;
+ ctx.strings.pointer = 0;
ctx.exception = 0;

if (njs_fast_path(njs_is_fast_array(this))) {
@@ -3304,7 +3307,6 @@ njs_array_prototype_sort(njs_vm_t *vm, n
und = 0;
p = NULL;
end = NULL;
- slots = NULL;

for (i = 0; i < length; i++) {
if (p >= end) {
@@ -3406,7 +3408,10 @@ njs_array_prototype_sort(njs_vm_t *vm, n

exception:

- njs_mp_free(vm->mem_pool, slots);
+ if (slots != NULL) {
+ njs_mp_free(vm->mem_pool, slots);
+ }
+
njs_arr_destroy(&ctx.strings);

return ret;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed use-of-uninitialized-value after 1d0825906438.

Dmitry Volyntsev 266 May 27, 2020 09:42AM



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

Online Users

Guests: 189
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready