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 38480fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- 'include/**'
- 'src/**'
- 'test/**'
- 'tools/**'
- 'vendor/**'
- 'Cargo.toml'
- 'Cargo.lock'
Expand All @@ -20,6 +21,7 @@ on:
- 'include/**'
- 'src/**'
- 'test/**'
- 'tools/**'
- 'vendor/**'
- 'Cargo.toml'
- 'Cargo.lock'
Expand Down
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 38480fc

Please sign in to comment.