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

A panic occured #527

Closed
thecaptury opened this issue Jan 6, 2023 · 2 comments · Fixed by #528
Closed

A panic occured #527

thecaptury opened this issue Jan 6, 2023 · 2 comments · Fixed by #528
Assignees

Comments

@thecaptury
Copy link

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

@mstange mstange self-assigned this Jan 6, 2023
@mstange
Copy link
Collaborator

mstange commented Jan 6, 2023

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.

mstange added a commit to mstange/dump_syms that referenced this issue Jan 6, 2023
mstange added a commit to mstange/dump_syms that referenced this issue Jan 6, 2023
@thecaptury
Copy link
Author

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

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

Successfully merging a pull request may close this issue.

2 participants