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
37.42k stars 1.64k forks source link

[Bug] Visualisers often cause crashes #1721

Open ZwipZwapZapony opened 1 month ago

ZwipZwapZapony commented 1 month ago

Operating System

Windows

What's the issue you encountered?

When using the hex::visualize attribute on a pattern and clicking on the eye icon to view the visualised data, ImHex crashes fairly often. (Edit: The crashing is deterministic based on the visualiser data, not a random chance - but it still happens often.)

How can the issue be reproduced?

Create a new file, copy and paste u8 data @ $ [[hex::visualize("abc")]]; into the Pattern Editor, run the pattern, and click on the eye icon in the Pattern Data tab.

All of these (and likely more) cause crashes:

u8 data_invalid @ 0 [[hex::visualize("abc")]]; //"abc" is not a valid visualizer

u8 data_bitmap @ 0 [[hex::visualize("bitmap",this,1,1)]]; //Also crashes if it's u32 (which would be enough bytes for a 1x1 RGBA8 bitmap),
//does not crash if it's an array (unless the array has too few bytes for width x height RGBA8 - u32[1] and u8[4] work the same in that regard)

u8 data_hex_viewer @ 0 [[hex::visualize("hex_viewer",this)]]; //Also crashes if it's an array

float model_vertices[9]; //For data_3d below
model_vertices[0] = -1; //X1
model_vertices[1] = 0;  //Y1
model_vertices[2] = 0;  //Z1
model_vertices[3] = 0;  //X2
model_vertices[4] = 0;  //Y2
model_vertices[5] = 1;  //Z2
model_vertices[6] = 1;  //X3
model_vertices[7] = 0;  //Y3
model_vertices[8] = 0;  //Z3
u8 data_3d @ 0 [[hex::visualize("3d",model_vertices,null)]]; //Also crashes without ",null"

ImHex Version

v1.33.2, and nightly @ 0b0bf90e

ImHex Build Type

Installation type

Portable nightly zip

Additional context?

[Crash log]