This was new to me, I hadn't encountered this failure while working
on the original "other I32 bugs".
The original test here was failing with an "Out of memory" error
since the long hash key length was overflowing the I32.
Once that was fixed the test was failing purely due to the invalid
code, once that was fixed the test passed so I removed the TODO.
{
SSize_t keylen;
const char * const key = SvPV_const(sv, *(STRLEN*)&keylen);
- SV *nsv = newSVpvn_share(key, SvUTF8(sv) ? -keylen : keylen, 0);
+ if (keylen > I32_MAX) {
+ Perl_croak_nocontext("Sorry, hash keys must be smaller than 2**31 bytes");
+ }
+
+ SV *nsv = newSVpvn_share(key, SvUTF8(sv) ? -(I32)keylen : (I32)keylen, 0);
SvREFCNT_dec_NN(sv);
*svp = nsv;
}
qr/^\QSorry, hash keys must be smaller than 2**31 bytes\E\b/,
"hash constructed with huge key");
-TODO: {
- local $TODO = "Doesn't yet work with OP_MULTIDEREF";
- like(exn('my %h; %h{ "x" x 2**31 } = undef'),
- qr/^\QSorry, hash keys must be smaller than 2**31 bytes\E\b/,
- "assign to huge hash key");
-}
+like(exn('my %h; $h{ "x" x 2**31 } = undef'),
+ qr/^\QSorry, hash keys must be smaller than 2**31 bytes\E\b/,
+ "assign to huge hash key");