summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2004-06-07 23:09:42 +0300
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-06-08 13:44:27 +0000
commit2b573acec7886e18e5f2804e8915073100dce2e4 (patch)
tree60c48c757c95672d726a096029840f65f872f61b /pp_hot.c
parent7b614c55f5b832a2a6bef87f61ab8323c0d06c60 (diff)
downloadperl-2b573acec7886e18e5f2804e8915073100dce2e4.tar.gz
Re: [PATCH] Re: Lack of error for large string on Solaris
Message-ID: <40C4A156.5030205@iki.fi> p4raw-id: //depot/perl@22904
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pp_hot.c b/pp_hot.c
index c3ce802e3c..3a89b6f1c3 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2879,6 +2879,18 @@ PP(pp_aelem)
RETPUSHUNDEF;
svp = av_fetch(av, elem, lval && !defer);
if (lval) {
+#ifdef PERL_MALLOC_WRAP
+ static const char oom_array_extend[] =
+ "Out of memory during array extend"; /* Duplicated in av.c */
+ if (SvUOK(elemsv)) {
+ UV uv = SvUV(elemsv);
+ elem = uv > IV_MAX ? IV_MAX : uv;
+ }
+ else if (SvNOK(elemsv))
+ elem = (IV)SvNV(elemsv);
+ if (elem > 0)
+ MEM_WRAP_CHECK_1(elem,SV*,oom_array_extend);
+#endif
if (!svp || *svp == &PL_sv_undef) {
SV* lv;
if (!defer)