mirror of
https://github.com/zrax/pycdc.git
synced 2026-06-23 11:34:07 +00:00
Fixes for large operands (> 0x7fff). Closes #34
This commit is contained in:
parent
5e4b2fcf9c
commit
ad03ec3034
2 changed files with 3 additions and 14 deletions
13
bytecode.cpp
13
bytecode.cpp
|
|
@ -273,24 +273,15 @@ void bc_next(PycBuffer& source, PycModule* mod, int& opcode, int& operand, int&
|
|||
{
|
||||
opcode = Pyc::ByteToOpcode(mod->majorVer(), mod->minorVer(), source.getByte());
|
||||
operand = 0;
|
||||
bool haveExtArg = false;
|
||||
pos += 1;
|
||||
|
||||
if (opcode == Pyc::EXTENDED_ARG_A) {
|
||||
operand = source.get16() << 16;
|
||||
opcode = source.getByte();
|
||||
haveExtArg = true;
|
||||
opcode = Pyc::ByteToOpcode(mod->majorVer(), mod->minorVer(), source.getByte());
|
||||
pos += 3;
|
||||
}
|
||||
if (opcode >= Pyc::PYC_HAVE_ARG) {
|
||||
// If we have an extended arg, we want to OR the lower part,
|
||||
// else we want the whole thing (in case it's negative). We use
|
||||
// the bool so that values between 0x8000 and 0xFFFF can be stored
|
||||
// without becoming negative
|
||||
if (haveExtArg)
|
||||
operand |= (source.get16() & 0xFFFF);
|
||||
else
|
||||
operand = source.get16();
|
||||
operand |= source.get16();
|
||||
pos += 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue