Skip to content

Commit

Permalink
Fix a compiler warning
Browse files Browse the repository at this point in the history
Possible integer overflow.
  • Loading branch information
gbrail committed Jul 26, 2024
1 parent 01719fe commit cc302b4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ private Object js_lastIndexOf(Object[] args) {
long start;
if (args.length < 2) {
// default
start = length - 1;
start = length - 1L;
} else {
start = (long) ScriptRuntime.toInteger(args[1]);
if (start >= length) start = length - 1;
if (start >= length) start = length - 1L;
else if (start < 0) start += length;
if (start < 0) return -1;
}
Expand Down

0 comments on commit cc302b4

Please sign in to comment.