mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
Revert "Added partial bounds check for instruction pointer in ACS VM"
This reverts commit 83cd53c9b1
.
This commit is contained in:
parent
23c50540f6
commit
72f181be08
1 changed files with 15 additions and 30 deletions
|
@ -761,35 +761,6 @@ protected:
|
|||
private:
|
||||
DLevelScript();
|
||||
|
||||
int getbyte(int *&pc)
|
||||
{
|
||||
CheckInstructionPointer(pc);
|
||||
|
||||
int res = *(uint8_t *)pc;
|
||||
pc = (int *)((uint8_t *)pc+1);
|
||||
return res;
|
||||
}
|
||||
|
||||
int getshort(int *&pc)
|
||||
{
|
||||
CheckInstructionPointer(pc);
|
||||
|
||||
int res = LittleShort( *(int16_t *)pc);
|
||||
pc = (int *)((uint8_t *)pc+2);
|
||||
return res;
|
||||
}
|
||||
|
||||
void CheckInstructionPointer(int *pc) const
|
||||
{
|
||||
const uint32_t offset = activeBehavior->PC2Ofs(pc);
|
||||
const uint32_t size = activeBehavior->GetDataSize();
|
||||
|
||||
if (offset >= size)
|
||||
{
|
||||
I_Error("Out of bounds instruction pointer in ACS VM");
|
||||
}
|
||||
}
|
||||
|
||||
friend class DACSThinker;
|
||||
};
|
||||
|
||||
|
@ -6925,7 +6896,7 @@ enum
|
|||
};
|
||||
|
||||
|
||||
#define NEXTWORD (CheckInstructionPointer(pc), LittleLong(*pc++))
|
||||
#define NEXTWORD (LittleLong(*pc++))
|
||||
#define NEXTBYTE (fmt==ACS_LittleEnhanced?getbyte(pc):NEXTWORD)
|
||||
#define NEXTSHORT (fmt==ACS_LittleEnhanced?getshort(pc):NEXTWORD)
|
||||
#define STACK(a) (Stack[sp - (a)])
|
||||
|
@ -6933,6 +6904,20 @@ enum
|
|||
// Direct instructions that take strings need to have the tag applied.
|
||||
#define TAGSTR(a) (a|activeBehavior->GetLibraryID())
|
||||
|
||||
inline int getbyte (int *&pc)
|
||||
{
|
||||
int res = *(uint8_t *)pc;
|
||||
pc = (int *)((uint8_t *)pc+1);
|
||||
return res;
|
||||
}
|
||||
|
||||
inline int getshort (int *&pc)
|
||||
{
|
||||
int res = LittleShort( *(int16_t *)pc);
|
||||
pc = (int *)((uint8_t *)pc+2);
|
||||
return res;
|
||||
}
|
||||
|
||||
static bool CharArrayParms(int &capacity, int &offset, int &a, FACSStackMemory& Stack, int &sp, bool ranged)
|
||||
{
|
||||
if (ranged)
|
||||
|
|
Loading…
Reference in a new issue