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
45.2k stars 1.97k forks source link

[Bug] Pattern Evaluation crashes when certain pragma combination is added #1962

Open knight-ryu12 opened 3 days ago

knight-ryu12 commented 3 days ago

Operating System

Windows

What's the issue you encountered?

Pattern evaluation may crash ImHex with 0xc5 error.

How can the issue be reproduced?

Minimal Reproduction Patterns:

#pragma endian little
#pragma bitfield_order right_to_left
bitfield test1 {
    m1: 12;
    m2: 4;
};

ImHex Version

v1.35.4

ImHex Build Type

Installation type

Installaler

Additional context?

No response

paxcut commented 3 days ago

Actually v1.35.4 crashes if you only add the the now deprecated pragma for bit-field ordering:

#pragma bitfield_order right_to_left

I ran that on the 1.36.0 nightly and instead of a crash I got an error message:

E: error: Pragma 'bitfield_order' is unsupported.
E:   -->   in <Source Code>:2:37
E: 2 | #pragma bitfield_order right_to_left
E:                                         ^

E: Bitfield order can be overridden on a field declaration with the `be` or `le` keywords.
E: error: Value 'right_to_left' cannot be used with the 'bitfield_order' pragma directive.
E:   -->   in <Source Code>:2:1
E: 2 | #pragma bitfield_order right_to_left
E:     ^^^^^^^^^^^^^
I: Evaluation took 0.0773874s

so it looks like it is already fixed but the fix hasn't made it to the release version yet.,