]> mj.ucw.cz Git - libucw.git/commitdiff
Added ASSERT checks for tag byte syntax. Didn't find any errors yet.
authorMartin Mares <mj@ucw.cz>
Tue, 27 Mar 2001 16:29:07 +0000 (16:29 +0000)
committerMartin Mares <mj@ucw.cz>
Tue, 27 Mar 2001 16:29:07 +0000 (16:29 +0000)
lib/index.h

index ebd28f3aa29f27cbab22bcd74e753a8d987dbe4d..97af12f5d286d3044f6f85797b3d4e039af8304b 100644 (file)
@@ -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;                                        \
     }                                                          \