summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgs@consttype.org>2010-03-31 09:50:00 +0200
committerRafael Garcia-Suarez <rgs@consttype.org>2010-03-31 09:50:00 +0200
commit572558b47236782e60e41bd235c96eae7cbca3db (patch)
tree8ac9468ea092abb09b436f011a79d57a21e424c8 /pp.c
parent87b5b7338739cea183f8be8fdb800a2d1173c028 (diff)
downloadperl-572558b47236782e60e41bd235c96eae7cbca3db.tar.gz
Avoid a segfault when reversing an empty array in-place.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 5876cfd607..daa63af9a4 100644
--- a/pp.c
+++ b/pp.c
@@ -5420,7 +5420,7 @@ PP(pp_reverse)
SV **begin = AvARRAY(av);
SV **end = begin + AvFILLp(av);
- while (begin < end) {
+ while (begin && begin < end) {
register SV * const tmp = *begin;
*begin++ = *end;
*end-- = tmp;