[njs] Fixed Buffer.prototype.indexOf() on 32bits platforms.

noreply at nginx.com noreply at nginx.com
Fri Oct 11 01:28:02 UTC 2024


details:   https://github.com/nginx/njs/commit/6902aaa17d8a2f30c44f2ed0ed165605233a2c6d
branches:  master
commit:    6902aaa17d8a2f30c44f2ed0ed165605233a2c6d
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu, 10 Oct 2024 16:33:13 -0700
description:
Fixed Buffer.prototype.indexOf() on 32bits platforms.


---
 src/njs_buffer.c | 2 +-
 src/qjs_buffer.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/njs_buffer.c b/src/njs_buffer.c
index 2f0fc620..3ce1b90a 100644
--- a/src/njs_buffer.c
+++ b/src/njs_buffer.c
@@ -2198,7 +2198,7 @@ encoding:
             }
 
         } else {
-            to -= str.length - 1;
+            to -= (int64_t) str.length - 1;
 
             if (from > to) {
                 goto done;
diff --git a/src/qjs_buffer.c b/src/qjs_buffer.c
index 02618387..9f451e26 100644
--- a/src/qjs_buffer.c
+++ b/src/qjs_buffer.c
@@ -1071,7 +1071,7 @@ encoding:
         }
 
     } else {
-        to -= str.length - 1;
+        to -= (int64_t) str.length - 1;
 
         if (from > to) {
             goto done;


More information about the nginx-devel mailing list