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] Crash with a section pattern inside a struct #2043

Open
1 task done
rsp4jack opened this issue Jan 1, 2025 · 1 comment
Open
1 task done

[Bug] Crash with a section pattern inside a struct #2043

rsp4jack opened this issue Jan 1, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@rsp4jack
Copy link

rsp4jack commented Jan 1, 2025

Operating System

Linux

What's the issue you encountered?

It crashes.

Is that allowed? Anyway it should not crash.

How can the issue be reproduced?

import std.mem;
struct Foo {
    std::mem::Section sec = std::mem::create_section("sec");
    u8 array[12] @ 0x00 in sec;
};
Foo foo;

ImHex Version

0a55f4b

ImHex Build Type

  • Nightly or built from sources

Installation type

workflow's pacman package

Additional context?

No response

@rsp4jack rsp4jack added the bug Something isn't working label Jan 1, 2025
@paxcut
Copy link
Contributor

paxcut commented Jan 1, 2025

I am pretty sure that should give an error instead of crashing which I can confirm it also does in windows 10 using any version i tried.

It appears the crash is created when the array is placed in the section within the struct. If you move the placement outside of the struct and using foo.sec instead of just sec creates the section and places the variable there. Filling the array with values works as well. In other words, the following code works as expected

import std.mem;

struct Foo {
    std::mem::Section sec = std::mem::create_section("sec");
};

Foo foo;
u8 array[12] @ 0x00 in foo.sec;

array[0] = 20;

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