Skip to content

Commit d1a3bb5

Browse files
hsbtclaude
andcommitted
Fix lengths of 2**30 or more where long is 32 bits
#rest_size, #skip, #match?, #skip_until and #exist? passed the length to INT2FIX, which does not fit past FIXNUM_MAX. On x64-mswin64 the result printed as the right number but was not equal to it, and `rest_size + rest_size` came out negative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 315fe21 commit d1a3bb5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎ext/strscan/strscan.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ strscan_do_scan(VALUE self, VALUE pattern, int succptr, int getstr, int headonly
826826
return extract_beg_len(p, p->prev, length);
827827
}
828828
else {
829-
return INT2FIX(length);
829+
return LEN2NUM(length);
830830
}
831831
}
832832
}
@@ -2190,7 +2190,7 @@ strscan_rest_size(VALUE self)
21902190
return INT2FIX(0);
21912191
}
21922192
i = S_RESTLEN(p);
2193-
return INT2FIX(i);
2193+
return LEN2NUM(i);
21942194
}
21952195

21962196
#define INSPECT_LENGTH 5

0 commit comments

Comments
 (0)