Przeglądaj źródła

structure: BStringTrie: fix an overflow just introduced, in case int is bigger than size_t

ambrop7 14 lat temu
rodzic
commit
08c662612c
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      structure/BStringTrie.h

+ 1 - 1
structure/BStringTrie.h

@@ -66,7 +66,7 @@ static int BStringTrie__new_node (BStringTrie *o, int *out_nodeidx)
     ASSERT(out_nodeidx)
     
     if (o->count == o->capacity) {
-        if (o->capacity > INT_MAX / 2) {
+        if (o->capacity > INT_MAX / 2 || o->capacity > SIZE_MAX / 2) {
             return 0;
         }
         int newcap = 2 * o->capacity;