dbghelp/dwarf: Validate that a string is in the section boundary before using it.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
23f0ebbca6
commit
3111daa222
|
@ -601,9 +601,19 @@ static BOOL dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
|
|||
break;
|
||||
|
||||
case DW_FORM_strp:
|
||||
attr->u.string = (const char*)ctx->sections[section_string].address +
|
||||
dwarf2_get_addr(data, ctx->head.offset_size);
|
||||
TRACE("strp<%s>\n", debugstr_a(attr->u.string));
|
||||
{
|
||||
ULONG_PTR ofs = dwarf2_get_addr(data, ctx->head.offset_size);
|
||||
if (ofs >= ctx->sections[section_string].size)
|
||||
{
|
||||
ERR("Out of bounds string offset (%08lx)\n", ofs);
|
||||
attr->u.string = "<<outofbounds-strp>>";
|
||||
}
|
||||
else
|
||||
{
|
||||
attr->u.string = (const char*)ctx->sections[section_string].address + ofs;
|
||||
TRACE("strp<%s>\n", debugstr_a(attr->u.string));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case DW_FORM_block:
|
||||
|
|
Loading…
Reference in New Issue