- Check for string pointer being outside of the string table.
- Only parse typedefs on stabs entries that can have them.
This commit is contained in:
parent
be7c95a3e5
commit
20546c84bb
|
@ -1094,6 +1094,7 @@ BOOL stabs_parse(struct module* module, const char* addr,
|
||||||
unsigned int stabbufflen;
|
unsigned int stabbufflen;
|
||||||
const struct stab_nlist* stab_ptr;
|
const struct stab_nlist* stab_ptr;
|
||||||
const char* strs;
|
const char* strs;
|
||||||
|
const char* strs_end;
|
||||||
int strtabinc;
|
int strtabinc;
|
||||||
char symname[4096];
|
char symname[4096];
|
||||||
unsigned incl[32];
|
unsigned incl[32];
|
||||||
|
@ -1107,6 +1108,7 @@ BOOL stabs_parse(struct module* module, const char* addr,
|
||||||
nstab = stablen / sizeof(struct stab_nlist);
|
nstab = stablen / sizeof(struct stab_nlist);
|
||||||
stab_ptr = (const struct stab_nlist*)(addr + staboff);
|
stab_ptr = (const struct stab_nlist*)(addr + staboff);
|
||||||
strs = (const char*)(addr + strtaboff);
|
strs = (const char*)(addr + strtaboff);
|
||||||
|
strs_end = strs + strtablen;
|
||||||
|
|
||||||
memset(srcpath, 0, sizeof(srcpath));
|
memset(srcpath, 0, sizeof(srcpath));
|
||||||
memset(stabs_basic, 0, sizeof(stabs_basic));
|
memset(stabs_basic, 0, sizeof(stabs_basic));
|
||||||
|
@ -1123,6 +1125,11 @@ BOOL stabs_parse(struct module* module, const char* addr,
|
||||||
for (i = 0; i < nstab; i++, stab_ptr++)
|
for (i = 0; i < nstab; i++, stab_ptr++)
|
||||||
{
|
{
|
||||||
ptr = strs + stab_ptr->n_un.n_strx;
|
ptr = strs + stab_ptr->n_un.n_strx;
|
||||||
|
if ((ptr > strs_end) || (ptr + strlen(ptr) > strs_end))
|
||||||
|
{
|
||||||
|
WARN("Bad stabs string %p\n", ptr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ptr[strlen(ptr) - 1] == '\\')
|
if (ptr[strlen(ptr) - 1] == '\\')
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1145,6 +1152,15 @@ BOOL stabs_parse(struct module* module, const char* addr,
|
||||||
ptr = stabbuff;
|
ptr = stabbuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* only symbol entries contain a typedef */
|
||||||
|
switch (stab_ptr->n_type)
|
||||||
|
{
|
||||||
|
case N_GSYM:
|
||||||
|
case N_LCSYM:
|
||||||
|
case N_STSYM:
|
||||||
|
case N_RSYM:
|
||||||
|
case N_LSYM:
|
||||||
|
case N_ROSYM:
|
||||||
if (strchr(ptr, '=') != NULL)
|
if (strchr(ptr, '=') != NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1164,6 +1180,7 @@ BOOL stabs_parse(struct module* module, const char* addr,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
const char* defs[] = {"","","","", /* 00 */
|
const char* defs[] = {"","","","", /* 00 */
|
||||||
|
|
Loading…
Reference in New Issue