[njs] Fixed used of uninitialized memory in String.prototype.match().
Alexander Borisov
alexander.borisov at nginx.com
Thu Jul 11 12:43:48 UTC 2019
details: https://hg.nginx.org/njs/rev/b5f72739c00e
branches:
changeset: 1040:b5f72739c00e
user: Alexander Borisov <alexander.borisov at nginx.com>
date: Thu Jul 11 15:42:33 2019 +0300
description:
Fixed used of uninitialized memory in String.prototype.match().
diffstat:
njs/njs_string.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (20 lines):
diff -r b4e326104195 -r b5f72739c00e njs/njs_string.c
--- a/njs/njs_string.c Thu Jul 11 15:33:40 2019 +0300
+++ b/njs/njs_string.c Thu Jul 11 15:42:33 2019 +0300
@@ -2734,8 +2734,14 @@ njs_string_match_multiple(njs_vm_t *vm,
start = p + captures[0];
if (captures[1] == 0) {
- p = nxt_utf8_next(start, end);
- string.size = end - p;
+ if (start < end) {
+ p = nxt_utf8_next(start, end);
+ string.size = end - p;
+
+ } else {
+ /* To exit the loop. */
+ p++;
+ }
size = 0;
length = 0;
More information about the nginx-devel
mailing list