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] #2109

Open
1 task done
aryanmandal20 opened this issue Feb 12, 2025 · 1 comment
Open
1 task done

[Bug] #2109

aryanmandal20 opened this issue Feb 12, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@aryanmandal20
Copy link

Operating System

Linux

What's the issue you encountered?

The decompression routine in ImHex fails due to an incorrect memory copy operation. The issue occurs when processing compressed data, causing incorrect output and potential memory corruption.

Error details:
The function decompress() incorrectly handles dictionary offsets, leading to out-of-bounds memory reads.
The condition checking inbyte & 0x80 and subsequent cases do not correctly extract the required offset and length.
This results in misaligned or corrupted decompressed data.
Expected behavior:
The decompression should correctly extract data, maintaining proper offsets.
Actual behavior:
Data is either corrupted or incorrectly placed in the output buffer.
The program may crash due to invalid memory access.

How can the issue be reproduced?

1.Open ImHex and load a binary file that uses the decompression format.

2.Run the decompression routine on the data.

3.Observe incorrect or corrupted output.

4.If debugging, notice incorrect offsets in memory operations.

ImHex Version

1.30.1

ImHex Build Type

  • Nightly or built from sources

Installation type

AppImage

Additional context?

1.The bug is related to how std::mem::copy_value_to_section() is used in decompression.

2.The binary being analyzed is compressed using an LZ-like algorithm.

3.Attached is a sample binary where the bug occurs.

@aryanmandal20 aryanmandal20 added the bug Something isn't working label Feb 12, 2025
@paxcut
Copy link
Contributor

paxcut commented Feb 12, 2025

The current version of ImHex is 1.36.2. Try that first and see if error still exists. If version is a typo, please try a recent build since many bug related to compression were fixed. Also please post the file so we can test it if it still occurs.

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