Skip to content

Commit

Permalink
Fix signedness issue in the DWARF line parser on ARM64 (#17031)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoundThe committed Jun 12, 2020
1 parent ffe743e commit f298057
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions libr/bin/dwarf.c
Expand Up @@ -247,11 +247,11 @@ static const ut8 *r_bin_dwarf_parse_lnp_header(
}
hdr->min_inst_len = READ8 (buf);
if (hdr->version >= 4) {
hdr->max_ops_per_inst = READ (buf, ut8);
hdr->max_ops_per_inst = READ8 (buf);
}
hdr->file_names = NULL;
hdr->default_is_stmt = READ8 (buf);
hdr->line_base = READ (buf, char);
hdr->line_base = READ (buf, int8_t);
hdr->line_range = READ8 (buf);
hdr->opcode_base = READ8 (buf);

Expand Down Expand Up @@ -562,12 +562,12 @@ static const ut8* r_bin_dwarf_parse_spec_opcode(
}
advance_adr = adj_opcode / hdr->line_range;
regs->address += advance_adr;
regs->line += hdr->line_base + (adj_opcode % hdr->line_range);
int line_increment = hdr->line_base + (adj_opcode % hdr->line_range);
regs->line += line_increment;
if (f) {
fprintf (f, " Special opcode %d: ", adj_opcode);
fprintf (f, "advance Address by %"PFMT64d" to 0x%"PFMT64x" and Line by %d to %"PFMT64d"\n",
advance_adr, regs->address, hdr->line_base +
(adj_opcode % hdr->line_range), regs->line);
advance_adr, regs->address, line_increment, regs->line);
}
if (binfile && binfile->sdb_addrinfo && hdr->file_names) {
int idx = regs->file -1;
Expand Down
2 changes: 1 addition & 1 deletion libr/include/r_bin_dwarf.h
Expand Up @@ -715,7 +715,7 @@ typedef struct {
ut8 min_inst_len;
ut8 max_ops_per_inst;
ut8 default_is_stmt;
char line_base;
st32 line_base;
ut8 line_range;
ut8 opcode_base;
ut8 *std_opcode_lengths;
Expand Down

0 comments on commit f298057

Please sign in to comment.