dbghelp: Properly bail out if get an error while reading ELF header.

This commit is contained in:
Eric Pouech 2010-03-20 09:48:13 +01:00 committed by Alexandre Julliard
parent 375d158da7
commit 4c3361e39e
1 changed files with 6 additions and 1 deletions

View File

@ -272,7 +272,12 @@ static BOOL elf_map_file(const WCHAR* filenameW, struct image_file_map* fmap)
lseek(fmap->u.elf.fd, fmap->u.elf.elfhdr.e_shoff, SEEK_SET); lseek(fmap->u.elf.fd, fmap->u.elf.elfhdr.e_shoff, SEEK_SET);
for (i = 0; i < fmap->u.elf.elfhdr.e_shnum; i++) for (i = 0; i < fmap->u.elf.elfhdr.e_shnum; i++)
{ {
read(fmap->u.elf.fd, &fmap->u.elf.sect[i].shdr, sizeof(fmap->u.elf.sect[i].shdr)); if (read(fmap->u.elf.fd, &fmap->u.elf.sect[i].shdr, sizeof(fmap->u.elf.sect[i].shdr)) != sizeof(fmap->u.elf.sect[i].shdr))
{
HeapFree(GetProcessHeap, 0, fmap->u.elf.sect);
fmap->u.elf.sect = NULL;
goto done;
}
fmap->u.elf.sect[i].mapped = IMAGE_NO_MAP; fmap->u.elf.sect[i].mapped = IMAGE_NO_MAP;
} }