summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-09-21 21:53:24 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-09-22 21:01:43 -0400
commitd3475fb81a1317499d42d46a16d7a21789b26667 (patch)
tree7a8c4046f54496e79cae8dfb38436a9b62575ead /pp_pack.c
parentb15c1b561a4d9a6ec5ecdf68b69fda7ef7d09cb7 (diff)
downloadperl-d3475fb81a1317499d42d46a16d7a21789b26667.tar.gz
No point in pack 'w' for inf/nan.
(For inf, the existing code already did this, slowly.)
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/pp_pack.c b/pp_pack.c
index d703a99b7d..17f7182f82 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -2900,12 +2900,17 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV **beglist, SV **endlist )
char buf[1 + (int)((308 + 1) / 2)]; /* valid C */
#endif
char *in = buf + sizeof(buf);
+ static const char S_cannot_compress[] =
+ "Cannot compress integer in pack";
+
+ if (Perl_isinfnan(anv))
+ Perl_croak(aTHX_ S_cannot_compress);
anv = Perl_floor(anv);
do {
const NV next = Perl_floor(anv / 128);
if (in <= buf) /* this cannot happen ;-) */
- Perl_croak(aTHX_ "Cannot compress integer in pack");
+ Perl_croak(aTHX_ S_cannot_compress);
*--in = (unsigned char)(anv - (next * 128)) | 0x80;
anv = next;
} while (anv > 0);