Skip to content

Commit

Permalink
[7.0.0] ijar: Widen some size types. (#19995)
Browse files Browse the repository at this point in the history
This is a follow up to
ac10bac.

Closes #19722.

Commit
a69fdb8

PiperOrigin-RevId: 577864132
Change-Id: I4b7165b6abfd55f545811bd16c8e5cf02ae183ae

Co-authored-by: Benjamin Peterson <[email protected]>
  • Loading branch information
bazel-io and benjaminp authored Oct 31, 2023
1 parent 69feddb commit cb16d07
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions third_party/ijar/zip_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,14 @@ char **read_filelist(char *filename) {
}

int nb_entries = 1;
for (int i = 0; i < file_stat.total_size; i++) {
for (u8 i = 0; i < file_stat.total_size; i++) {
if (data[i] == '\n') {
nb_entries++;
}
if (nb_entries == INT_MAX) {
fprintf(stderr, "too many input files");
return NULL;
}
}

size_t sizeof_array = sizeof(char *) * (nb_entries + 1);
Expand All @@ -271,7 +275,7 @@ char **read_filelist(char *filename) {
// Create the corresponding array
int j = 1;
filelist[0] = content;
for (int i = 0; i < file_stat.total_size; i++) {
for (u8 i = 0; i < file_stat.total_size; i++) {
if (content[i] == '\n') {
content[i] = 0;
if (i + 1 < file_stat.total_size) {
Expand Down

0 comments on commit cb16d07

Please sign in to comment.