Browse code

oss-fuzz - 13509 - fix type sizes for base64 character encoding and screnc buffer tag lengths

Mickey Sola authored on 2019/03/13 00:58:01
Showing 1 changed files
... ...
@@ -91,7 +91,7 @@ typedef enum {
91 91
 typedef struct file_buff_tag {
92 92
     int fd;
93 93
     unsigned char buffer[HTML_FILE_BUFF_LEN];
94
-    size_t length;
94
+    uint64_t length;
95 95
 } file_buff_t;
96 96
 
97 97
 struct tag_contents {
... ...
@@ -100,7 +100,7 @@ struct tag_contents {
100 100
 };
101 101
 
102 102
 // clang-format off
103
-static const int32_t base64_chars[256] = {
103
+static const int64_t base64_chars[256] = {
104 104
     -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
105 105
     -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
106 106
     -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
... ...
@@ -591,7 +591,7 @@ static void screnc_decode(unsigned char *ptr, struct screnc_state *s)
591 591
     if (!s->length) {
592 592
         size_t remaining;
593 593
         if (strlen((const char *)ptr) >= 12) {
594
-            uint32_t expected;
594
+            uint64_t expected;
595 595
             expected = base64_chars[ptr[0]] < 0 ? 0 : base64_chars[ptr[0]] << 2;
596 596
             expected += base64_chars[ptr[1]] >> 4;
597 597
             expected += (base64_chars[ptr[1]] & 0x0f) << 12;