We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 690dffa commit 59f9cc3Copy full SHA for 59f9cc3
src/core/t-string.c
@@ -30,6 +30,7 @@
30
#include "sys-core.h"
31
#include "sys-scan.h"
32
#include "sys-deci-funcs.h"
33
+#include "sys-int-funcs.h"
34
35
/***********************************************************************
36
**
@@ -541,9 +542,10 @@ static REBSER *make_binary(REBVAL *arg, REBOOL make)
541
542
case A_PICK:
543
case A_POKE:
544
len = Get_Num_Arg(arg); // Position
- index += len - 1;
545
//if (len > 0) index--;
546
- if (index < 0 || index >= tail) {
+ if (REB_I32_SUB_OF(len, 1, &len)
547
+ || REB_I32_ADD_OF(index, len, &index)
548
+ || index < 0 || index >= tail) {
549
if (action == A_PICK) goto is_none;
550
Trap_Range(arg);
551
}
0 commit comments