]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
sort_malloc_shadows: check a loop bound in establishing initial shellsort
authorJulian Seward <jseward@acm.org>
Mon, 11 Nov 2002 08:36:52 +0000 (08:36 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 11 Nov 2002 08:36:52 +0000 (08:36 +0000)
step size.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1286

coregrind/vg_memory.c

index 613f8f99b3d9ef47aba5974783862c4a93549a46..6b610a0b9d00b155536078965ead201570a9ed09 100644 (file)
@@ -691,7 +691,8 @@ void sort_malloc_shadows ( ShadowChunk** shadows, UInt n_shadows )
    ShadowChunk* v;
 
    bigN = hi - lo + 1; if (bigN < 2) return;
-   hp = 0; while (incs[hp] < bigN) hp++; hp--;
+   hp = 0; while (hp < 14 && incs[hp] < bigN) hp++; hp--;
+   vg_assert(0 <= hp && hp < 14);
 
    for (; hp >= 0; hp--) {
       h = incs[hp];