Skip to content

SEGV in expr.cc from small_vector.hh #78

Description

@Starkeus

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: #36

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions