diff --git a/inc/lektor/stb/ds.h b/inc/lektor/stb/ds.h
index 2a0c631e7e1561e4a01954fa4a49a11ff0086c5d..d26097e02fc2a00f5bd6e711c1a7e9ea045ea591 100644
--- a/inc/lektor/stb/ds.h
+++ b/inc/lektor/stb/ds.h
@@ -795,7 +795,7 @@ stbds_arrgrowf(void *a, size_t elemsize, size_t addlen, size_t min_cap)
 {
     stbds_array_header temp = { 0 }; // force debugging
     void *b;
-    size_t min_len = stbds_arrlen(a) + addlen;
+    size_t min_len = ((size_t)stbds_arrlen(a)) + addlen;
     (void)sizeof(temp);
 
     // compute the minimum capacity needed
@@ -921,13 +921,13 @@ stbds_log2(size_t slot_count)
 static stbds_hash_index *
 stbds_make_hash_index(size_t slot_count, stbds_hash_index *ot)
 {
-    stbds_hash_index *t;
-    t             = (stbds_hash_index *)STBDS_REALLOC(NULL, 0,
-                                                      (slot_count >> STBDS_BUCKET_SHIFT) *
-                                                              sizeof(stbds_hash_bucket) +
-                                                          sizeof(stbds_hash_index) + STBDS_CACHE_LINE_SIZE - 1);
-    t->storage    = (stbds_hash_bucket *)STBDS_ALIGN_FWD((size_t)(t + 1), STBDS_CACHE_LINE_SIZE);
-    t->slot_count = slot_count;
+    stbds_hash_index *t = (stbds_hash_index *)STBDS_REALLOC(
+        NULL, 0,
+        (slot_count >> STBDS_BUCKET_SHIFT) * sizeof(stbds_hash_bucket) + sizeof(stbds_hash_index) +
+            (size_t)(STBDS_CACHE_LINE_SIZE - 1));
+    t->storage =
+        (stbds_hash_bucket *)STBDS_ALIGN_FWD((size_t)(t + 1), (size_t)STBDS_CACHE_LINE_SIZE);
+    t->slot_count      = slot_count;
     t->slot_count_log2 = stbds_log2(slot_count);
     t->tombstone_count = 0;
     t->used_count      = 0;