Merge pull request #385 from DrChat/xex_getprocaddr_fix
XexModule::GetProcAddress false out of bounds fix
This commit is contained in:
commit
d71c35bbe9
|
@ -89,12 +89,13 @@ uint32_t XexModule::GetProcAddress(uint16_t ordinal) const {
|
||||||
auto export_table = memory()->TranslateVirtual<const xex2_export_table*>(
|
auto export_table = memory()->TranslateVirtual<const xex2_export_table*>(
|
||||||
xex_security_info()->export_table);
|
xex_security_info()->export_table);
|
||||||
|
|
||||||
|
ordinal -= export_table->base;
|
||||||
if (ordinal > export_table->count) {
|
if (ordinal > export_table->count) {
|
||||||
XELOGE("GetProcAddress(%.3X): ordinal out of bounds", ordinal);
|
XELOGE("GetProcAddress(%.3X): ordinal out of bounds", ordinal);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t num = ordinal - export_table->base;
|
uint32_t num = ordinal;
|
||||||
uint32_t ordinal_offset = export_table->ordOffset[num];
|
uint32_t ordinal_offset = export_table->ordOffset[num];
|
||||||
ordinal_offset += export_table->imagebaseaddr << 16;
|
ordinal_offset += export_table->imagebaseaddr << 16;
|
||||||
return ordinal_offset;
|
return ordinal_offset;
|
||||||
|
|
Loading…
Reference in New Issue