mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
[ruby/strscan] scan_integer(base: 16)
ignore x suffix if not
followed by hexadecimal
(https://github.com/ruby/strscan/pull/141)
Fix: https://github.com/ruby/strscan/issues/140
`0x<EOF>`, `0xZZZ` should be parsed as `0` instead of not matching at
all.
c4e4795ed2
This commit is contained in:
parent
0f8a6e1f59
commit
bf6c106d54
2 changed files with 15 additions and 10 deletions
|
@ -1379,7 +1379,7 @@ strscan_scan_base16_integer(VALUE self)
|
|||
len++;
|
||||
}
|
||||
|
||||
if ((remaining_len >= (len + 2)) && ptr[len] == '0' && ptr[len + 1] == 'x') {
|
||||
if ((remaining_len >= (len + 3)) && ptr[len] == '0' && ptr[len + 1] == 'x' && rb_isxdigit(ptr[len + 2])) {
|
||||
len += 2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue