mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Uses a signed char
instead of a char
for opcode stack offset. On some platforms like ARM, char
is unsigned by default
This fixes #311 where a memory corruption that occurred in ARM was caused because of insufficient ScriptVM stack size. The stack size was incorrectly calculated because the stack offset was using unsigned values instead of signed in ARM.
This commit is contained in:
parent
2f48ca6adb
commit
13197acb3a
3 changed files with 3 additions and 3 deletions
|
@ -77,7 +77,7 @@ unsigned char ScriptCompiler::PrevOpcode()
|
||||||
return prev_opcodes[prev_opcode_pos].opcode;
|
return prev_opcodes[prev_opcode_pos].opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
char ScriptCompiler::PrevVarStackOffset()
|
signed char ScriptCompiler::PrevVarStackOffset()
|
||||||
{
|
{
|
||||||
return prev_opcodes[prev_opcode_pos].VarStackOffset;
|
return prev_opcodes[prev_opcode_pos].VarStackOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
unsigned char PrevOpcode();
|
unsigned char PrevOpcode();
|
||||||
char PrevVarStackOffset();
|
signed char PrevVarStackOffset();
|
||||||
void AbsorbPrevOpcode();
|
void AbsorbPrevOpcode();
|
||||||
void ClearPrevOpcode();
|
void ClearPrevOpcode();
|
||||||
void AccumulatePrevOpcode(int opcode, int iVarStackOffset);
|
void AccumulatePrevOpcode(int opcode, int iVarStackOffset);
|
||||||
|
|
|
@ -50,7 +50,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char opcode;
|
unsigned char opcode;
|
||||||
char VarStackOffset;
|
signed char VarStackOffset;
|
||||||
} opcode_info_t;
|
} opcode_info_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue