From 58fd07abbebbc9a6e46886280560be39adbc41e9 Mon Sep 17 00:00:00 2001 From: Dmitry Volyntsev Date: Thu, 10 Oct 2024 16:33:13 -0700 Subject: [PATCH] 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 2f0fc620d..3ce1b90a3 100644 --- a/src/njs_buffer.c +++ b/src/njs_buffer.c @@ -2198,7 +2198,7 @@ njs_buffer_prototype_index_of(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, } } 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 026183877..9f451e26f 100644 --- a/src/qjs_buffer.c +++ b/src/qjs_buffer.c @@ -1071,7 +1071,7 @@ qjs_buffer_prototype_index_of(JSContext *ctx, JSValueConst this_val, int argc, } } else { - to -= str.length - 1; + to -= (int64_t) str.length - 1; if (from > to) { goto done;