Fix x86 sign-extension of high pointers

This commit is contained in:
Mikusch
2026-06-17 19:37:25 -04:00
committed by Nicholas Hastings
parent 87a325f68e
commit f5cea78b45
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -559,7 +559,7 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
if (int err = pContext->LocalToPhysAddr(params[retparam], &sp_addr); err != SP_ERROR_NONE) {
return pContext->ThrowNativeErrorEx(err, "Could not read argument");
}
*reinterpret_cast<int64_t*>(sp_addr) = reinterpret_cast<intptr_t>(addr);
*reinterpret_cast<int64_t*>(sp_addr) = reinterpret_cast<uintptr_t>(addr);
return 0;
} else {
cell_t *addr = (cell_t *)vc->retbuf;
+1 -2
View File
@@ -304,7 +304,7 @@ DataStatus EncodeValveParam(IPluginContext *pContext,
if (pContext->LocalToPhysAddr(param, &sp_addr) != SP_ERROR_NONE) {
return Data_Fail;
}
*reinterpret_cast<int64_t*>(sp_addr) = reinterpret_cast<intptr_t>(*(void**)buffer);
*reinterpret_cast<int64_t*>(sp_addr) = reinterpret_cast<uintptr_t>(*(void**)buffer);
return Data_Okay;
}
@@ -635,7 +635,6 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
}
void* addr = (void*)(*reinterpret_cast<int64_t*>(sp_addr));
if (addr == nullptr && (data->decflags & VDECODE_FLAG_ALLOWNULL) == 0)
{
pContext->ThrowNativeError("NULL Address not allowed");