From: Martin Mares Date: Tue, 27 Mar 2001 16:29:07 +0000 (+0000) Subject: Added ASSERT checks for tag byte syntax. Didn't find any errors yet. X-Git-Tag: holmes-import~1499 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=dd6ceba421c4d5853c4d266447ef9c2fb5ac9446;p=libucw.git Added ASSERT checks for tag byte syntax. Didn't find any errors yet. --- diff --git a/lib/index.h b/lib/index.h index ebd28f3a..97af12f5 100644 --- a/lib/index.h +++ b/lib/index.h @@ -101,9 +101,16 @@ fp_hash(struct fingerprint *fp) { \ p++; \ if (u >= 0xb0) \ - u += 0x80020000; \ + { \ + if (u != 0xb0) \ + ASSERT(0); \ + u += 0x80020000; \ + } \ else if (u >= 0xa0) \ - u = 0x80010000 + ((u & 0x0f) << 6) + (*p++ & 0x3f); \ + { \ + ASSERT(*p >= 0x80 && *p <= 0xbf); \ + u = 0x80010000 + ((u & 0x0f) << 6) + (*p++ & 0x3f); \ + } \ else \ u += 0x80000000; \ } \