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

how to validate filed with custom function? #199

Closed
leanid opened this issue Jul 5, 2017 · 2 comments
Closed

how to validate filed with custom function? #199

leanid opened this issue Jul 5, 2017 · 2 comments

Comments

@leanid
Copy link

leanid commented Jul 5, 2017

meta:
  id: dvpl
  file-extension: dvpl
  endian: le
seq:
  - id: compressed_data
    size: _io.size - 20
  - id: dvpl_footer
    type: dvpl_footer_t
types:
  dvpl_footer_t:
    seq:
      - id: size_uncompressed
        type: u4
      - id: size_compressed
        type: u4
      - id: crc32_compressed
        type: u4
      - id: compressor_type
        type: u4
        enum: compression
      - id: pack_marker_lite
        contents: "DVPL"
enums:
  compression:
    0: none
    1: lz4
    2: lz4hc
    3: deflate

I want to validate: crc32_check(_root.compressed_data) == _root.dvpl_footer.crc32_compressed. Is it possible? And if it is possible how to add custom decompress function to check:

var bytes = decompress(_root.dvpl_footer.compressor_type, _root.compressor_data)
len(bytes) == _root.dvpl_footer.size_uncompressed;
crc32_check(bytes) == _root.dvpl_footer.crc32_uncompressed;

Thanks in advance!

@koczkatamas
Copy link
Member

koczkatamas commented Jul 5, 2017

Not supported yet, please see: #81

I am closing as a duplicate, if you think it's a mistake, please re-open.

(We collect the similar issues in a single place, so please continue this discussion in #81. Thanks!)

@GreyCat
Copy link
Member

GreyCat commented Jul 5, 2017

I want to validate: crc32_check(_root.compressed_data) == _root.dvpl_footer.crc32_compressed. Is it possible?

There is a discussion on checksum / generic assertion checking in #81. There is no ready-to-use implementation right now in the compiler.

And if it is possible how to add custom decompress function to check:

Custom processing (decompressing) functions are discussed in #51. We'll be deploying simple custom processing solution shortly.

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

No branches or pull requests

3 participants