Avoid a segfault when reversing an empty array in-place.
Rafael Garcia-Suarez [Wed, 31 Mar 2010 07:50:00 +0000 (09:50 +0200)]
pp.c

diff --git a/pp.c b/pp.c
index 5876cfd..daa63af 100644 (file)
--- 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;