Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0AA6 pointer validation relaxed for legacy scripts #82

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cleo_plugins/MemoryOperations/MemoryOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,17 @@ class MemoryOperations
static OpcodeResult __stdcall opcode_0AA6(CLEO::CRunningScript* thread)
{
auto func = OPCODE_READ_PARAM_PTR();
auto obj = OPCODE_READ_PARAM_PTR();

void* obj = nullptr;
if (!IsLegacyScript(thread))
{
obj = OPCODE_READ_PARAM_PTR();
}
else
{
obj = (void*)OPCODE_READ_PARAM_INT(); // at least one mod used 0AA6 with 0 as struct argument (effectively turning it into 0AA5 opcode...)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also use ternary operator

Copy link
Collaborator Author

@MiranDMC MiranDMC Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for macros expanding into multiple lines. That is also reason for the brackets of such simple if-else.


auto numArgs = OPCODE_READ_PARAM_INT();
auto numPop = OPCODE_READ_PARAM_INT();

Expand Down