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

convenient way to handle "break on wrong value" sequences #1072

Open
enwony opened this issue Oct 12, 2023 · 2 comments
Open

convenient way to handle "break on wrong value" sequences #1072

enwony opened this issue Oct 12, 2023 · 2 comments
Labels

Comments

@enwony
Copy link

enwony commented Oct 12, 2023

There are some formats that rely on non-magic field to detect if sequence if exausted.

For example, this ksy:

meta:
  id: test
  file-extension: test
  endian: le

seq:
  - id: sequence
    repeat: until
    repeat-until: _.type != 0xBABECAFE
    type: myrecord
    
  - id: data
    size-eos: true

types:
  myrecord:
    seq:
    - id: type
      type: u4
    
    - id: value
      type: u4

for this file:

0xBABECAFE 
0x0000000001
0xBABECAFE
0x0000000001
...rest of data...

one additional myrecord consumed from rest of data
workaround is to parse such cases manually
how can I handle it in more convenient way?
could I use new valid expression?

@generalmimon
Copy link
Member

@enwony I believe this has been already suggested in #156 (and #625, which I've already marked as a duplicate of #156) - please continue the discussion there if this is the case.

@enwony
Copy link
Author

enwony commented Oct 12, 2023

I hoped than valid expression somehow can handle this

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

No branches or pull requests

2 participants