summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-03-03 16:11:07 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-03-03 16:11:07 +0000
commit979699d98f9c8ca879b6dea581eae11291896b43 (patch)
tree45cc5eb2ef85d61f91b2672ff2fd6ea3721c80d1 /util.c
parentbfc3ae4fccf261f3ffcd77b5f339738dcd4ce290 (diff)
downloadperl-979699d98f9c8ca879b6dea581eae11291896b43.tar.gz
EBCDIC: the v-string components cannot exceed 2147483647.
p4raw-id: //depot/perl@14963
Diffstat (limited to 'util.c')
-rw-r--r--util.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/util.c b/util.c
index 26b63d05b4..a9f9ade8f6 100644
--- a/util.c
+++ b/util.c
@@ -4012,35 +4012,39 @@ Perl_new_vstring(pTHX_ char *s, SV *sv)
for (;;) {
rev = 0;
{
- /* this is atoi() that tolerates underscores */
- char *end = pos;
- UV mult = 1;
- if ( *(s-1) == '_') {
- mult = 10;
- }
- while (--end >= s) {
- UV orev;
- orev = rev;
- rev += (*end - '0') * mult;
- mult *= 10;
- if (orev > rev && ckWARN_d(WARN_OVERFLOW))
- Perl_warner(aTHX_ WARN_OVERFLOW,
- "Integer overflow in decimal number");
- }
+ /* this is atoi() that tolerates underscores */
+ char *end = pos;
+ UV mult = 1;
+ if ( *(s-1) == '_') {
+ mult = 10;
+ }
+ while (--end >= s) {
+ UV orev;
+ orev = rev;
+ rev += (*end - '0') * mult;
+ mult *= 10;
+ if (orev > rev && ckWARN_d(WARN_OVERFLOW))
+ Perl_warner(aTHX_ WARN_OVERFLOW,
+ "Integer overflow in decimal number");
+ }
}
+#ifdef EBCDIC
+ if (rev > 0x7FFFFFFF)
+ Perl_croak(aTHX "In EBCDIC the v-string components cannot exceed 2147483647");
+#endif
/* Append native character for the rev point */
tmpend = uvchr_to_utf8(tmpbuf, rev);
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(rev)))
- SvUTF8_on(sv);
+ SvUTF8_on(sv);
if ( (*pos == '.' || *pos == '_') && isDIGIT(pos[1]))
- s = ++pos;
+ s = ++pos;
else {
- s = pos;
- break;
+ s = pos;
+ break;
}
while (isDIGIT(*pos) )
- pos++;
+ pos++;
}
SvPOK_on(sv);
SvREADONLY_on(sv);