shreaker/OpenXCP

Segmentation fault and ELF parser issues

Opened this issue · 3 comments

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?
Thanks.

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");
}

I threw in an expression error and I actually got "empty stack while initializing DWARF expression" multiple times. Wondering why the stack is empty and the seg fault happens.

One possible reason is that the elf file which you selected is dwarfv5 format while libelfin only supports dwarfv4 format.

Possibly right.
Is there any way I can remove the libelfin from this library and Parse an A2L instead?
My goal is to have an A2L that I load so a Linux PC that connects to my ECUs sends variable requests which can be matched with their addresses, and the ECUs return back with data.