Skip to content

Commit 07c8b54

Browse files
committed
optscript: reject negative numbers for specifying rolling objects
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 2c46b9a commit 07c8b54

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

Tmain/optscript.d/stack.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@
3434
3
3535
3
3636
/A
37+
/rangecheck

Tmain/optscript.d/stack.ps

124 Bytes
Binary file not shown.

dsl/optscript.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2772,6 +2772,8 @@ op_roll (OptVM *vm, EsObject *name)
27722772
if (!es_integer_p (nobj))
27732773
return OPT_ERR_TYPECHECK;
27742774
int n = es_integer_get (nobj);
2775+
if (n < 0)
2776+
return OPT_ERR_RANGECHECK;
27752777

27762778
if ((((int)c) - 2) < n)
27772779
return OPT_ERR_UNDERFLOW;

0 commit comments

Comments
 (0)