Skip to content

Incorrect display of unparsed elements when using non-contigious type #180

@podcherklife

Description

@podcherklife

If element is non-contigious e.g. has 'instances' section part that points to a different part of the file, hex viewer displays some parts of the file as unparsed when toggling "disable lazy parsing".

Apparently this happens because fillInterals in ParsedTreeHandler.getNode function discards intervals that have start <= lastEnd. I tried to remove this condition and then sort intervals by start, and that seemed to fix the problem, however I did not go further than that.

example .ksy :

meta:
  id: test
  file-extension: test_input


seq:
  - id: header
    type: header
  - id: elements
    type: element
    repeat: expr
    repeat-expr: header.elements_count
  
    
    
types:
  element: 
    seq:
      - id: element_body_offset
        type: u1
      - id: element_body_size
        type: u1
    instances:
      body:
        pos: element_body_offset
        size: element_body_size
        type: str
        encoding: ASCII
  header:
    seq:
      - id: elements_count
        type: u1

Test file (it is not actually a zip) test_input.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions