Align library table entires on Big Endian machines
Not doing this causes the VM to crash on startup inside amx_Init() when extracting the names of linked libraries from the name table.
This commit is contained in:
parent
8cc4c02b20
commit
2f86aa0541
@ -1041,6 +1041,16 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
|||||||
AMX_FUNCSTUB *fs;
|
AMX_FUNCSTUB *fs;
|
||||||
int i,num;
|
int i,num;
|
||||||
|
|
||||||
|
fs=GETENTRY(hdr,publics,0);
|
||||||
|
assert(hdr->publics<=hdr->natives);
|
||||||
|
num=NUMENTRIES(hdr,publics,natives);
|
||||||
|
for (i=0; i<num; i++) {
|
||||||
|
amx_AlignCell(&fs->address);
|
||||||
|
if (USENAMETABLE(hdr))
|
||||||
|
amx_Align32(&((AMX_FUNCSTUBNT*)fs)->nameofs);
|
||||||
|
fs=(AMX_FUNCSTUB*)((unsigned char *)fs+hdr->defsize);
|
||||||
|
} /* for */
|
||||||
|
|
||||||
fs=GETENTRY(hdr,natives,0);
|
fs=GETENTRY(hdr,natives,0);
|
||||||
num=NUMENTRIES(hdr,natives,libraries);
|
num=NUMENTRIES(hdr,natives,libraries);
|
||||||
for (i=0; i<num; i++) {
|
for (i=0; i<num; i++) {
|
||||||
@ -1050,9 +1060,8 @@ int AMXAPI amx_Init(AMX *amx,void *program)
|
|||||||
fs=(AMX_FUNCSTUB*)((unsigned char *)fs+hdr->defsize);
|
fs=(AMX_FUNCSTUB*)((unsigned char *)fs+hdr->defsize);
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
fs=GETENTRY(hdr,publics,0);
|
fs=GETENTRY(hdr,libraries,0);
|
||||||
assert(hdr->publics<=hdr->natives);
|
num=NUMENTRIES(hdr,libraries,pubvars);
|
||||||
num=NUMENTRIES(hdr,publics,natives);
|
|
||||||
for (i=0; i<num; i++) {
|
for (i=0; i<num; i++) {
|
||||||
amx_AlignCell(&fs->address);
|
amx_AlignCell(&fs->address);
|
||||||
if (USENAMETABLE(hdr))
|
if (USENAMETABLE(hdr))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user