[njs] Improved njs_string_create_chb().

Dmitry Volyntsev xeioex at nginx.com
Wed Mar 8 05:09:20 UTC 2023


details:   https://hg.nginx.org/njs/rev/e3a609ff9001
branches:  
changeset: 2065:e3a609ff9001
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Mar 03 18:50:23 2023 -0800
description:
Improved njs_string_create_chb().

Adding a more informative description when the function cannot build a
valid UTF-8 string out of chained buffers.

diffstat:

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

diffs (12 lines):

diff -r 9367f3dfe0d9 -r e3a609ff9001 src/njs_string.c
--- a/src/njs_string.c	Fri Mar 03 22:57:30 2023 +0300
+++ b/src/njs_string.c	Fri Mar 03 18:50:23 2023 -0800
@@ -160,7 +160,7 @@ njs_string_create_chb(njs_vm_t *vm, njs_
 
     length = njs_chb_utf8_length(chain);
     if (njs_slow_path(length < 0)) {
-        njs_memory_error(vm);
+        njs_internal_error(vm, "invalid UTF-8 string");
         return NJS_ERROR;
     }
 


More information about the nginx-devel mailing list