]> git.ipfire.org Git - thirdparty/valgrind.git/commit
Fixed get_height to ensure that SK_MAXHEIGHT-1 is the maximum level we
authorTom Hughes <tom@compton.nu>
Thu, 28 Oct 2004 08:09:53 +0000 (08:09 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 28 Oct 2004 08:09:53 +0000 (08:09 +0000)
commit0e02fd4f4de042eefdc35df64c18e0670e6a965c
treefbbbfa1e3116e2133c4842a66e1eceed3dc23764
parent08e9ab9e62ccc162dfc2c4278e59ea0401543af4
Fixed get_height to ensure that SK_MAXHEIGHT-1 is the maximum level we
will allocate for a skip list entry as many routines use arrays of
size SK_MAXHEIGHT to hold a set of level pointers which means that a
level of SK_MAXHEIGHT is not valid due to C arrays being zero based.

This led to a number of subtle and hard to locate problems caused by
stack based arrays being overflowed by one entry when a node was
allocated with the maximum level. As each node only has a one in two
million or so chance of getting a level of SK_MAXHEIGHT this didn't
actually happen all that often.

MERGED FROM HEAD

git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@2863
coregrind/vg_skiplist.c