Skip to content

Commit

Permalink
Fix #23581 - (again) bin3 dwarf infinite loop ##crash
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored Nov 16, 2024
1 parent 70d2e26 commit 968c92b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libr/bin/dwarf.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ static const ut8 *parse_line_header_source_dwarf5(RBin *bin, RBinFile *bf, const

ut64 index;
size_t count = 0;
for (index = 0; buf && index < total_entries; index++) {
for (index = 0; buf && buf < buf_end && index < total_entries; index++) {
const ut8 *format = entry_format;

ut8 entry_format_index;
Expand Down Expand Up @@ -871,6 +871,9 @@ static const ut8 *parse_line_header_source_dwarf5(RBin *bin, RBinFile *bf, const
buf = nbuf;
}
break;
default:
R_LOG_WARN ("Invalid form code %d", form_code);
break;
}

switch (content_type_code) {
Expand Down Expand Up @@ -930,6 +933,10 @@ static const ut8 *parse_line_header_source_dwarf5(RBin *bin, RBinFile *bf, const
memcpy (hdr->file_names[count].md5sum, sum, sizeof sum);
}
break;
default:
buf = NULL;
R_LOG_ERROR ("Invalid ior unsupported DW line number content type %d", content_type_code);
break;
}
}

Expand All @@ -947,6 +954,7 @@ static const ut8 *parse_line_header_source_dwarf5(RBin *bin, RBinFile *bf, const
hdr->file_names[count].file_len, hdr->file_names[count].name);
} else {
R_LOG_WARN ("file_names is null");
buf = NULL;
}
break;
}
Expand Down

0 comments on commit 968c92b

Please sign in to comment.