Skip to content

Commit 8227fdc

Browse files
committed
fix: fix py27 RAISE_VARARGS_A cause pycdc crash
1 parent a05ddec commit 8227fdc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ASTree.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <cstring>
22
#include <cstdint>
33
#include <stdexcept>
4+
#include <cstdio>
5+
#include <cassert>
46
#include <unordered_set>
57
#include "ASTree.h"
68
#include "FastStack.h"
@@ -1827,6 +1829,12 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
18271829
blocks.pop();
18281830
curblock = blocks.top();
18291831
curblock->append(prev.cast<ASTNode>());
1832+
// sometimes JUMP ins after raise
1833+
// so we should check the end of current block
1834+
// current not in block end, skip 1 ins
1835+
if (prev->end() != pos) {
1836+
bc_next(source, mod, opcode, operand, pos);
1837+
}
18301838
}
18311839
}
18321840
break;
@@ -1848,8 +1856,9 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
18481856
blocks.pop();
18491857
curblock = blocks.top();
18501858
curblock->append(prev.cast<ASTNode>());
1851-
1852-
bc_next(source, mod, opcode, operand, pos);
1859+
if (prev->end() != pos) {
1860+
bc_next(source, mod, opcode, operand, pos);
1861+
}
18531862
}
18541863
}
18551864
break;

0 commit comments

Comments
 (0)