From: Julian Seward Date: Wed, 4 Sep 2013 06:17:44 +0000 (+0000) Subject: check_uuid_matches: fix infinite loop following rewrite of this X-Git-Tag: svn/VALGRIND_3_9_0~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d13136fceef34a749c4a494ec2a4402c7be8c31e;p=thirdparty%2Fvalgrind.git check_uuid_matches: fix infinite loop following rewrite of this function during big overhaul of the debuginfo reader earlier this year. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13529 --- diff --git a/coregrind/m_debuginfo/readmacho.c b/coregrind/m_debuginfo/readmacho.c index 94865cbbe7..15eb1ad45f 100644 --- a/coregrind/m_debuginfo/readmacho.c +++ b/coregrind/m_debuginfo/readmacho.c @@ -652,7 +652,7 @@ static Bool check_uuid_matches ( DiSlice sli, UChar* uuid ) UInt i; /* Scan through the 1K chunk we got, looking for the start char. */ for (i = 0; i < (UInt)nGot; i++) { - if (buf[i] != first) + if (LIKELY(buf[i] != first)) continue; /* first char matches. See if we can get 16 bytes at this offset, and compare. */ @@ -662,8 +662,8 @@ static Bool check_uuid_matches ( DiSlice sli, UChar* uuid ) if (0 == VG_(memcmp)(&buff16[0], &uuid[0], 16)) return True; } - curr_off += nGot; } + curr_off += nGot; } return False; }