Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEGV in expr.cc from small_vector.hh #78

Open
Starkeus opened this issue Dec 19, 2023 · 0 comments
Open

SEGV in expr.cc from small_vector.hh #78

Starkeus opened this issue Dec 19, 2023 · 0 comments

Comments

@Starkeus
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant