summaryrefslogtreecommitdiff
path: root/external/libexttextcat/ubsan.patch
blob: 767a9a00361942da0aa0c19583eda28b8ff87e61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- src/fingerprint.c
+++ src/fingerprint.c
@@ -128,7 +128,7 @@
  */
 static uint4 simplehash(const char *p, int len)
 {
-    sint4 h = len * 13;
+    uint4 h = len * 13;
     while (*p)
     {
         h = (h << 5) - h + *p++;
--- src/utf8misc.c
+++ src/utf8misc.c
@@ -61,7 +61,7 @@
          * if the first bit of the current char is 1 then *str is an escape
          * character
          */
-        char escape_char = ((*str & WEIGHT_MASK) << 1);
+        unsigned char escape_char = ((*str & WEIGHT_MASK) << 1);
 
         /* 
          * and we use it to count (by bit translation) following characters
@@ -99,7 +99,7 @@
          * then str[pointer] is an escape character and we use it to count
          * following characters (only the weightest part)
          */
-        char escape_char = ((str[pointer] & WEIGHT_MASK) << 1);
+        unsigned char escape_char = ((str[pointer] & WEIGHT_MASK) << 1);
 
         /* 
          * every step, we move the byte of 1 bit left, when first bit is 0,
@@ -138,7 +138,7 @@
              * (only the weightest part)
              */
 
-            char escape_char = ((key[pointer] & WEIGHT_MASK) << 1);
+            unsigned char escape_char = ((key[pointer] & WEIGHT_MASK) << 1);
 
             while (escape_char & ESCAPE_MASK && key[pointer] == lex[pointer])
             {