WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
43.96k stars 1.92k forks source link

[Bug] E: runtime error: Pattern count exceeded set limit of '131072' on OSX with ELF Pattern #1680

Closed iamthebot closed 4 months ago

iamthebot commented 4 months ago

Operating System

Mac OSX

What's the issue you encountered?

On OSX (M1 chip) IMHex opening an ELF file causes the ELF pattern to not work

Under the pattern editor we can see the error

E: 726 | struct ELF {
E:              ^^^
E: <Source Code>:745:1
E: 745 | ELF elf @ 0x00;
E:       ^^^

E: runtime error: Pattern count exceeded set limit of '131072'.

E: If this is intended, try increasing the limit using '#pragma pattern_limit <new_limit>'.

Note that manually adding #pragma pattern_limit 10000000 at the top fixes it.

How can the issue be reproduced?

Open a nontrivial ELF file like libcrypto.so.3 from openssl on an OSX machine with IMHex. Try seeing if the ELF pattern works.

ImHex Version

1.33.2

ImHex Build Type

Installation type

DMG

Additional context?

libcrypto_example.zip

jumanji144 commented 4 months ago

This is not a bug, as the console clearly states the steps that should be taken to resolve this. This is an intended feature, as we want to limit the amount of patterns to prevent infinite runtime.

iamthebot commented 4 months ago

@jumanji144 is there a way to set this default globally? So I don't have to edit the pattern every time?

paxcut commented 4 months ago

You can save the changes made to any pattern and either overwrite the installed one, given you have permissions to do so, or create your own copy. The one in the installation folder will be overwritten next time you install imhex but the one you save in your own pattern folder will not.