kaitai_struct icon indicating copy to clipboard operation
kaitai_struct copied to clipboard

Compiler does not check types in `endian.switch-on`

Open Mingun opened this issue 2 years ago • 0 comments

The following KSY compiled successfully (in stable WebIDE)

meta:
  id: endian_switch_on_bug
  endian:
    switch-on: param
    cases:
      0: be
      _: le
params:
  - id: param
    type: bool
seq:
  - id: size
    type: u2

Some targets actually throw an internal compiler error on this and do not generate anything. For example, Java target:

$ ./ksc-java/kaitai-struct-compiler-0.9/bin/kaitai-struct-compiler.bat --target java test.ksy
None.get

Mingun avatar Nov 22 '21 14:11 Mingun