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

[Bug] Crashes on Evaluate when Pattern Data is sorted by Value #1938

Open
1 task done
c6-dev opened this issue Oct 19, 2024 · 2 comments
Open
1 task done

[Bug] Crashes on Evaluate when Pattern Data is sorted by Value #1938

c6-dev opened this issue Oct 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@c6-dev
Copy link

c6-dev commented Oct 19, 2024

Operating System

Windows

What's the issue you encountered?

ImHex crashes when hitting "Evaluate" with about 30% chance, it seems to happen with various files and patterns at random on both stable and nightly versions, i have attached an example binary, pattern and a crash log. Crash logs always seem to point at hex::ui::PatternDrawer::sortPatterns. Please let me know if there is any additional context i can provide - this started out of nowhere and causes a lot of frustration.

How can the issue be reproduced?

Load the attached file, paste the pattern code, hit "Evaluate" 5-10 times - it crashes.

ImHex Version

1.36.0

ImHex Build Type

  • Nightly or built from sources

Installation type

MSI

Additional context?

BINARY.zip
pattern.txt
crash_log_20241019_100658.log

Update: only seems to happen when Pattern Data window is sorted by Value.

@c6-dev c6-dev added the bug Something isn't working label Oct 19, 2024
@c6-dev
Copy link
Author

c6-dev commented Oct 19, 2024

Oh, just as I posted the issue I noticed something - the Pattern Data window was sorted by Value tab. If I sort it by Name, the crashes don't seem to happen. As soon as i click on Value tab header and Evaluate a few times it dies.

@c6-dev c6-dev changed the title [Bug] Crashes when evaluating patterns [Bug] Crashes on Evaluate when Pattern Data is sorted by Value Oct 19, 2024
@paxcut
Copy link
Contributor

paxcut commented Oct 19, 2024

the bug is not related to evaluation but rather at the sorting process itself. I was able to reproduce it by simply clicking on the value headers which triggers the sort. As noted above the error is in sortPatterns and it happens in this line:

     result = left->getValue() <=> right->getValue();

the reason the segfault is triggered is the value of the right pattern pointer as shown in the following image:
image

I couldn't track back to why the right pointer is so wrong. both pointers are arguments to a lambda function but thats all I could find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants