Skip to content

Conversation

al4n4n
Copy link

@al4n4n al4n4n commented Apr 20, 2025

@Mrmaxmeier
Copy link
Contributor

Can you move this logic to Box or Header? 🙂

if (lbox == 1) {
  size = xlbox - 16;
} else {
  size = lbox - 8;
}

@al4n4n
Copy link
Author

al4n4n commented Apr 26, 2025

Hi @Mrmaxmeier, thanks for the advice! I was thinking that this way could explicitly show the field name in each different box instead of a general field name for each box. I believe it should be implemented in an elegant code style, but this is what I came up with. What do you think?

@WerWolv
Copy link
Owner

WerWolv commented May 10, 2025

Thanks a lot for the pattern! There seems to be some issue still when running the pattern on test file though. I don't know enough about the format really though. Here's the log from the CI

Executing pattern jxl.hexpat using test file jxl.hexpat.jxl
    [ERROR] [ Stack Trace ]
    [ERROR] <Source Code>:119:36 at address 0x0008
    [ERROR] 119 |         u8 remaining_bytes[lbox - 8];
                                         ^
    [ERROR] <Source Code>:120:5 at address 0x0008
    [ERROR] 120 |     }
          ^
    [ERROR] <Source Code>:115:8 at address 0x0008
    [ERROR] 115 | struct UnknownBox<auto lbox,
              ^^^^^^^^^^
    [ERROR] <Source Code>:136:45 at address 0x0008
    [ERROR] 136 |                    UnknownBox<header.lbox,
                          ^^^^^^^^^^
    [ERROR] <Source Code>:137:5 at address 0x0008
    [ERROR] 137 |     }
          ^
    [ERROR] <Source Code>:123:8 at address 0x0000
    [ERROR] 123 | struct Box {
             ^^^
    [ERROR] <Source Code>:140:1 at address 0x0000
    [ERROR] 140 | Box boxes[while(!std::mem::eof(
       ^^^
    [ERROR] Error happened with cursor at address 0xFF0A0054
    [ERROR] 

    [ERROR] runtime error: Array expanded past end of the data.
  -->   in <Source Code>:119:36
119 |         u8 remaining_bytes[lbox - 8];
                                         ^
Error when executing pattern!
119:36  runtime error: Array expanded past end of the data.
  -->   in <Source Code>:119:36
119 |         u8 remaining_bytes[lbox - 8];
                                         ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants