Skip to content

Commit

Permalink
fix: overflow in int before cast to size_t (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
iWas-Coder committed May 25, 2024
1 parent 7d7154f commit 73173c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/skap/src/skap.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ int main(void) {
}
}
for (usz i = 0; i < ARRLEN(imgs_paths); ++i) {
skap_idx_image_link_blob(&img_idxs[i], ftell(fd), imgs[i].width * imgs[i].height);
skap_idx_image_link_blob(&img_idxs[i], ftell(fd), (usz) imgs[i].width * imgs[i].height);
printf(" WRITE %s >> " SKAP_FILENAME "\n", imgs_paths[i]);
if (fwrite(imgs[i].data, sizeof(Color), imgs[i].width * imgs[i].height, fd) != (usz) (imgs[i].width * imgs[i].height)) {
if (fwrite(imgs[i].data, sizeof(Color), (usz) imgs[i].width * imgs[i].height, fd) != (usz) imgs[i].width * imgs[i].height) {
fprintf(stderr, "ERROR: unable to write to file\n");
skap_file_destroy(fd);
unload_imgs();
Expand Down

0 comments on commit 73173c6

Please sign in to comment.