]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
2 execontexts in an hash table chain are not necessarily the same size.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 24 Jun 2014 22:13:43 +0000 (22:13 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 24 Jun 2014 22:13:43 +0000 (22:13 +0000)
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

coregrind/m_execontext.c

index cec2c857001dfad3184e9ae2a0ed822926a34561..8747bdb9ebbe3b7e21098217762a079fec0893b4 100644 (file)
@@ -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;