SEGV in expr.cc from small_vector.hh
Sounds good. Seeing a segmentation fault in small_vector.hh when performing the push_back at line 167. This is creating issues at the ELF parser level. In expr.cc, line 42:
stack.reserve(arguments.size()); for (const taddr *elt = arguments.end() - 1; elt >= arguments.begin(); elt--) stack.push_back(*elt); // <- The value of elt is 0xfffffffffffffff8, which means the loop should be auto, despite which the seg fault occurs.
Which uses small_vector.hh's:
void push_back(const T& x)
{
reserve(size() + 1);
new (end) T(x);
end++;
}
How can I fix this and can anyone provide an ELF file they have tested with? On my end, I also changed the loop and I threw in an expression error and I actually got "empty stack while initializing DWARF expression" multiple times. Wondering why the small_vector stack becomes empty and the seg fault happens? stack.reserve(arguments.size()); for (auto elt = arguments.begin(); elt != arguments.end(); ++elt) stack.push_back(*elt); // Check if the stack is empty before using stack.back() if (stack.empty()) { throw expr_error("empty stack while initializing DWARF expression"); } This also looks similar to this issue: https://github.com/aclements/libelfin/issues/36