[njs] Fixed potential NULL-pointer dereference (CID 1464584).
Dmitry Volyntsev
xeioex at nginx.com
Tue Jul 7 12:25:25 UTC 2020
details: https://hg.nginx.org/njs/rev/7a8e3f0d52a6
branches:
changeset: 1453:7a8e3f0d52a6
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Tue Jul 07 12:23:42 2020 +0000
description:
Fixed potential NULL-pointer dereference (CID 1464584).
diffstat:
src/njs_generator.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (19 lines):
diff -r 29ff89055e29 -r 7a8e3f0d52a6 src/njs_generator.c
--- a/src/njs_generator.c Mon Jul 06 18:37:13 2020 +0000
+++ b/src/njs_generator.c Tue Jul 07 12:23:42 2020 +0000
@@ -571,8 +571,13 @@ njs_lookup_line(njs_vm_code_t *code, uin
njs_uint_t n;
njs_vm_line_num_t *map;
- n = (code->lines != NULL) ? code->lines->items : 0;
- map = (njs_vm_line_num_t *) code->lines->start;
+ n = 0;
+ map = NULL;
+
+ if (code->lines != NULL) {
+ n = code->lines->items;
+ map = (njs_vm_line_num_t *) code->lines->start;
+ }
while (n != 0) {
if (offset >= map->offset && (n == 1 || offset < map[1].offset)) {
More information about the nginx-devel
mailing list