diff options
| author | cremno <[email protected]> | 2015-05-28 12:52:44 +0200 |
|---|---|---|
| committer | cremno <[email protected]> | 2015-05-28 12:52:44 +0200 |
| commit | ce31272dba2a67772daeca34940c2e60cd183a85 (patch) | |
| tree | 7f2fa7ec823e376a21bf66d60d7da5b6d7ab5609 /src/hash.c | |
| parent | b1871cf446a5cde128f8601b5517a8760af67940 (diff) | |
| download | mruby-ce31272dba2a67772daeca34940c2e60cd183a85.tar.gz mruby-ce31272dba2a67772daeca34940c2e60cd183a85.zip | |
fix capture group index bug
atoi() is used to convert the index to an int but the behavior is
undefined if the value can't be represented.
> $9999999999
00007 NODE_SCOPE:
00007 NODE_BEGIN:
00007 NODE_NTH_REF: $2147483647
irep 00630580 nregs=2 nlocals=1 pools=0 syms=1 reps=0
file: (mirb)
7 000 OP_GETGLOBAL R1 :$2147483647
7 001 OP_STOP
Call strtoul() instead as its behavior in such cases is defined and add
a simple range check.
Alternatively NODE_NTH_REF's cdr could be changed from int to mrb_sym
(like NODE_GVAR).
Diffstat (limited to 'src/hash.c')
0 files changed, 0 insertions, 0 deletions
