pawndisasm: Fix crash when loading debug info
This complements commit 8383e5bbbf0ead53ce198cca276eba441535ca59. Fixes #38.
This commit is contained in:
parent
531d72d8cc
commit
8bb8671f1e
@ -144,20 +144,19 @@ int AMXAPI dbg_LoadInfo(AMX_DBG *amxdbg, FILE *fp)
|
|||||||
amx_Align32((uint32_t*)&amxdbg->linetbl[index].line);
|
amx_Align32((uint32_t*)&amxdbg->linetbl[index].line);
|
||||||
} /* for */
|
} /* for */
|
||||||
#endif
|
#endif
|
||||||
ptr += dbghdr.lines * sizeof(AMX_DBG_LINE);
|
ptr += (uint16_t)dbghdr.lines * sizeof(AMX_DBG_LINE);
|
||||||
|
|
||||||
/* detect dbghdr.lines overflow */
|
/* detect dbghdr.lines overflow */
|
||||||
while ((line = (AMX_DBG_LINE *)ptr)
|
while ((line = (AMX_DBG_LINE *)ptr)
|
||||||
&& (cell)line->address > (cell)(line - 1)->address) {
|
&& (cell)line->address > (cell)(line - 1)->address) {
|
||||||
dbghdr.lines = -1;
|
|
||||||
#if BYTE_ORDER==BIG_ENDIAN
|
#if BYTE_ORDER==BIG_ENDIAN
|
||||||
for (index = 0; index <= dbghdr.lines; index++) {
|
for (index = 0; index <= UINT16_MAX; index++) {
|
||||||
amx_AlignCell(&linetbl[index].address);
|
amx_AlignCell(&linetbl[index].address);
|
||||||
amx_Align32((uint32_t*)&linetbl[index].line);
|
amx_Align32((uint32_t*)&linetbl[index].line);
|
||||||
line++;
|
line++;
|
||||||
} /* for */
|
} /* for */
|
||||||
#endif
|
#endif
|
||||||
ptr += ((uint32_t)dbghdr.lines + 1) * sizeof(AMX_DBG_LINE);
|
ptr += ((uint32_t)UINT16_MAX + 1) * sizeof(AMX_DBG_LINE);
|
||||||
} /* while */
|
} /* while */
|
||||||
|
|
||||||
/* symbol table (plus index tags) */
|
/* symbol table (plus index tags) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user