fix heap oob-read in dwarf parser

https://gist.github.com/4352a2f4a239a96b90e7b23bb22e8ef1
for repro file
This commit is contained in:
Jeffrey Crowell 2016-06-24 14:58:47 +00:00
parent 2c086751b9
commit 36650442f5

View File

@ -1271,6 +1271,10 @@ static const ut8 *r_bin_dwarf_parse_comp_unit(Sdb *s, const ut8 *obuf,
cu->dies[cu->length].tag = da->decls[abbr_code - 1].tag;
abbr_code += offset;
if (da->capacity < abbr_code) {
return NULL;
}
for (i = 0; i < da->decls[abbr_code - 1].length; i++) {
if (cu->dies[cu->length].length ==
cu->dies[cu->length].capacity)