mozilla / dump_syms

Rewrite of breakpad dump_syms tools in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A panic occured

thecaptury opened this issue · comments

Hello,

when running this on my executable I get:

11:23:59 [ERROR] A panic occurred at src/line.rs:213: attempt to subtract with overflow

I'm running v2.1.1.

That line is:

last.len = sym_len - (last.rva - sym_rva);

the numbers that crash it are:

last.len = 19 - (5378094 - 5378114)

which my calculator says is

last.len = 19 - (-20)

but u32 cannot become negative of course...

The following code runs through but probably doesn't make sense.

        if last.rva < sym_rva {
            last.len = sym_len;
        } else {
            last.len = sym_len - (last.rva - sym_rva);
        }

On the other hand the input is somehow corrupted. So probably emitting anything reasonable is better than crashing...

If anyone has any ideas how solve this better let me know. I'm happy to help.

cheers,
nils

I've seen other files where the line records extended beyond the size of the function symbol. I didn't get to the bottom of why this was the case. In any case, we should fix the overflow when this happens.

Are you running dump_syms in debug mode? I recommend running with cargo run --release for better performance. This will also disable the overflow panic.

thanks for the cargo run --release hint (I'm new in the rust world) and thanks for looking into this.