dbghelp: Protect COFF line number parsing against out of bounds access.

This commit is contained in:
Eric Pouech 2012-05-20 09:43:52 +02:00 committed by Alexandre Julliard
parent e46d650d3f
commit dbd70d0917
1 changed files with 18 additions and 18 deletions

View File

@ -424,15 +424,11 @@ DECLSPEC_HIDDEN BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
* If we have spilled onto the next entrypoint, then
* bump the counter..
*/
for (;;)
for (; l+1 < coff_files.files[j].neps; l++)
{
if (symt_get_address(coff_files.files[j].entries[l+1], &addr) &&
msc_dbg->module->module.BaseOfImage + linepnt->Type.VirtualAddress < addr)
{
if (l+1 >= coff_files.files[j].neps) break;
symt_get_address(coff_files.files[j].entries[l+1], &addr);
if (((msc_dbg->module->module.BaseOfImage + linepnt->Type.VirtualAddress) < addr))
break;
l++;
}
if (coff_files.files[j].entries[l+1]->tag == SymTagFunction)
{
/*
@ -440,11 +436,15 @@ DECLSPEC_HIDDEN BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
* start of the function, so we need to subtract that offset
* first.
*/
symt_get_address(coff_files.files[j].entries[l+1], &addr);
symt_add_func_line(msc_dbg->module, (struct symt_function*)coff_files.files[j].entries[l+1],
coff_files.files[j].compiland->source, linepnt->Linenumber,
symt_add_func_line(msc_dbg->module,
(struct symt_function*)coff_files.files[j].entries[l+1],
coff_files.files[j].compiland->source,
linepnt->Linenumber,
msc_dbg->module->module.BaseOfImage + linepnt->Type.VirtualAddress - addr);
}
break;
}
}
}
}
}