Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/jruby/org/jruby/ext/strscan/RubyStringScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private RubyInteger strscanParseInteger(Ruby runtime, ByteList bytes, int ptr, i
setMatched();
adjustRegisters();

return ConvertBytes.byteListToInum(runtime, bytes, ptr, len, base, true);
return ConvertBytes.byteListToInum(runtime, bytes, ptr, ptr + len, base, true);
}

private void strscanMustAsciiCompat(Ruby runtime) {
Expand Down
6 changes: 6 additions & 0 deletions test/strscan/test_stringscanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,12 @@ def test_scan_integer
assert_equal(huge_integer.to_i, s.scan_integer)
assert_equal(2_000, s.pos)
assert_predicate(s, :matched?)

s = create_string_scanner('abc1')
s.pos = 3
assert_equal(1, s.scan_integer)
assert_equal(4, s.pos)
assert_predicate(s, :matched?)
end

def test_scan_integer_unmatch
Expand Down
Loading