Eric Pouech : dbghelp: Properly fail on PDB files generated by MSVC compiler version 14.31.
Alexandre Julliard
julliard at winehq.org
Tue May 3 15:39:25 CDT 2022
Module: wine
Branch: master
Commit: 4643bb28528e2a10060e12b8544301c0be3d3060
URL: https://source.winehq.org/git/wine.git/?a=commit;h=4643bb28528e2a10060e12b8544301c0be3d3060
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Tue May 3 11:26:01 2022 +0200
dbghelp: Properly fail on PDB files generated by MSVC compiler version 14.31.
Some internal bits of PDB files are different, so report & abort loading of
such PDB file until it's properly understood & supported (instead of
crashing).
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/msc.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 56c0f8b58e8..28b6bd12f2e 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -2856,7 +2856,7 @@ static void pdb_free_file(struct pdb_file_info* pdb_file)
HeapFree(GetProcessHeap(), 0, pdb_file->stream_dict);
}
-static void pdb_load_stream_name_table(struct pdb_file_info* pdb_file, const char* str, unsigned cb)
+static BOOL pdb_load_stream_name_table(struct pdb_file_info* pdb_file, const char* str, unsigned cb)
{
DWORD* pdw;
DWORD* ok_bits;
@@ -2869,7 +2869,7 @@ static void pdb_load_stream_name_table(struct pdb_file_info* pdb_file, const cha
count = *pdw++;
pdb_file->stream_dict = HeapAlloc(GetProcessHeap(), 0, (numok + 1) * sizeof(struct pdb_stream_name) + cb);
- if (!pdb_file->stream_dict) return;
+ if (!pdb_file->stream_dict) return FALSE;
cpstr = (char*)(pdb_file->stream_dict + numok + 1);
memcpy(cpstr, str, cb);
@@ -2879,7 +2879,7 @@ static void pdb_load_stream_name_table(struct pdb_file_info* pdb_file, const cha
if (*pdw++ != 0)
{
FIXME("unexpected value\n");
- return;
+ return FALSE;
}
for (i = j = 0; i < count; i++)
@@ -2895,6 +2895,7 @@ static void pdb_load_stream_name_table(struct pdb_file_info* pdb_file, const cha
/* add sentinel */
pdb_file->stream_dict[numok].name = NULL;
pdb_file->fpoext_stream = -1;
+ return TRUE;
}
static unsigned pdb_get_stream_by_name(const struct pdb_file_info* pdb_file, const char* name)
@@ -3169,8 +3170,7 @@ static BOOL pdb_init(const struct pdb_lookup* pdb_lookup, struct pdb_file_info*
pdb_lookup->filename, root->Age, pdb_lookup->age);
TRACE("found JG for %s: age=%x timestamp=%x\n",
pdb_lookup->filename, root->Age, root->TimeDateStamp);
- pdb_load_stream_name_table(pdb_file, &root->names[0], root->cbNames);
-
+ ret = pdb_load_stream_name_table(pdb_file, &root->names[0], root->cbNames);
pdb_free(root);
}
else if (!memcmp(image, PDB_DS_IDENT, sizeof(PDB_DS_IDENT)))
@@ -3206,7 +3206,7 @@ static BOOL pdb_init(const struct pdb_lookup* pdb_lookup, struct pdb_file_info*
pdb_lookup->filename, root->Age, pdb_lookup->age);
TRACE("found DS for %s: age=%x guid=%s\n",
pdb_lookup->filename, root->Age, debugstr_guid(&root->guid));
- pdb_load_stream_name_table(pdb_file, &root->names[0], root->cbNames);
+ ret = pdb_load_stream_name_table(pdb_file, &root->names[0], root->cbNames);
pdb_free(root);
}
@@ -3377,7 +3377,8 @@ static BOOL pdb_process_internal(const struct process* pcs,
break;
default:
FIXME("Unknown PDB_STREAM_INDEXES size (%u)\n", symbols.stream_index_size);
- break;
+ pdb_free(symbols_image);
+ return FALSE;
}
files_image = pdb_read_strings(pdb_file);
if (files_image) files_size = *(const DWORD*)(files_image + 8);
More information about the wine-cvs
mailing list