pycdc
pycdc copied to clipboard
Segmentation fault (core dumped)
When the .pyc file is large, pycdc outputs Segmentation fault (core dumped)
How large is your .pyc file?
yes. >=27kb .pyc
Is there any way to solve it?
It seems to be linked with the *.pyc file size or the depth of the code. Maybe allocating memory on loading the file.
(gdb) run sk.pyc
Starting program: /usr/local/bin/pycdc sk.pyc
# Source Generated with Decompyle++
# File: sk.pyc (Python 3.10)
Program received signal SIGSEGV, Segmentation fault.
0x00005555555b59c0 in std::vector<PycRef<ASTNode>, std::allocator<PycRef<ASTNode> > >::size() const ()
Just now got the same crash,
Program received signal SIGSEGV, Segmentation fault.
0x00005555555b5d78 in std::vector<PycRef<ASTNode>, std::allocator<PycRef<ASTNode> > >::size() const ()
Hello, I felt into same issue, but somehow I found the clue. The problem was, that the stack was empty but still program want to get the value from. My solution for this (hot fix, without further investigation): File ASTree.cpp:
Line 1187:
PycRef<ASTBlock> tmp = curblock;
blocks.pop();
if (blocks.size() == 0) {
break; } else {
curblock = blocks.top();} // changes
if (should_add_for_block) {
curblock->append(tmp.cast<ASTNode>());
}
Line 1268:
/* Special case */
if (blocks.size() != 0) {
prev = blocks.top(); // changes
}
Line 1353:
/* Special case */
if (blocks.size() != 0) {
prev = blocks.top(); // changes
}
Line 1363:
if (prev->blktype() == ASTBlock::BLK_MAIN) {
/* Something went out of control! */
prev = nil;
}
if (blocks.size() == 0) {
prev = nil; // changes
}
Line 1398:
if (blocks.size() == 0) {
curblock->setEnd(pos+offs); // changes
} else {
curblock = blocks.top(); // changes
}
if (curblock->blktype() == ASTBlock::BLK_EXCEPT) {
curblock->setEnd(pos+offs);
}
Adding ASTree.cpp: ASTree.txt Hope will work with your case!
Hello, I felt into same issue, but somehow I found the clue. The problem was, that the stack was empty but still program want to get the value from. My solution for this (hot fix, without further investigation): File ASTree.cpp:
Line 1187: PycRef<ASTBlock> tmp = curblock; blocks.pop(); if (blocks.size() == 0) { break; } else { curblock = blocks.top();} // changes if (should_add_for_block) { curblock->append(tmp.cast<ASTNode>()); }Line 1268: /* Special case */ if (blocks.size() != 0) { prev = blocks.top(); // changes }Line 1353: /* Special case */ if (blocks.size() != 0) { prev = blocks.top(); // changes }Line 1363: if (prev->blktype() == ASTBlock::BLK_MAIN) { /* Something went out of control! */ prev = nil; } if (blocks.size() == 0) { prev = nil; // changes }Line 1398: if (blocks.size() == 0) { curblock->setEnd(pos+offs); // changes } else { curblock = blocks.top(); // changes } if (curblock->blktype() == ASTBlock::BLK_EXCEPT) { curblock->setEnd(pos+offs); }Adding ASTree.cpp: ASTree.txt Hope will work with your case!
Thank you so much brother you saved my works!