From: Philippe Waroquiers Date: Tue, 24 Jun 2014 22:13:43 +0000 (+0000) Subject: 2 execontexts in an hash table chain are not necessarily the same size. X-Git-Tag: svn/VALGRIND_3_10_0~340 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b7ad6225a1b6f97ec7f4058d6960828951380e6;p=thirdparty%2Fvalgrind.git 2 execontexts in an hash table chain are not necessarily the same size. So, ensure that when size differs, we do not start to compare them, as this could otherwise cause a read buffer overrun git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14097 --- diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c index cec2c85700..8747bdb9eb 100644 --- a/coregrind/m_execontext.c +++ b/coregrind/m_execontext.c @@ -379,12 +379,9 @@ static ExeContext* record_ExeContext_wrk2 ( Addr* ips, UInt n_ips ) while (True) { if (list == NULL) break; ec_searchcmps++; - same = True; - for (i = 0; i < n_ips; i++) { - if (list->ips[i] != ips[i]) { - same = False; - break; - } + same = list->n_ips == n_ips; + for (i = 0; i < n_ips && same ; i++) { + same = list->ips[i] == ips[i]; } if (same) break; prev2 = prev;