From 2a2d1992541701e8b36d3c073917241eef22f1c4 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Sat, 20 Oct 2012 14:54:09 +0200 Subject: [PATCH] fix off-by-one error in key detection logic for uninitialized warnings Prior to this patch we would not look at the 0th bucket. --- sv.c | 2 +- t/lib/warnings/9uninit | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sv.c b/sv.c index f728516..9f9ef1c 100644 --- a/sv.c +++ b/sv.c @@ -13836,7 +13836,7 @@ S_find_hash_subscript(pTHX_ const HV *const hv, const SV *const val) array = HvARRAY(hv); - for (i=HvMAX(hv); i>0; i--) { + for (i=HvMAX(hv); i>=0; i--) { HE *entry; for (entry = array[i]; entry; entry = HeNEXT(entry)) { if (HeVAL(entry) != val) diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index db5c634..781d1fa 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -2043,7 +2043,6 @@ write; EXPECT Use of uninitialized value $x in string at - line 6. ######## -# TODO bugfix will come next patch # NAME off-by-one error in hash bucket walk in key detection logic use warnings 'uninitialized'; -- 2.7.4