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

Why got error: EOFError: requested 1 bytes, but only 0 bytes available #592

Closed
Tracked by #1070
jaroslaw-wieczorek opened this issue Jun 19, 2019 · 3 comments
Closed
Tracked by #1070

Comments

@jaroslaw-wieczorek
Copy link

jaroslaw-wieczorek commented Jun 19, 2019

I got that error:

Parse error: undefined
Call stack: undefined EOFError: requested 1 bytes, but only 0 bytes available

When I moved field value from object_quality_type to object_1.
In each situation whole type object_1 has size == b8.

seq:
   - id: new
     type: object_1
      repeat: eos

types:
   object_1:
      seq:
         - id: quality
           type: object_quality_type

    object_quality_type:
        seq:
          - id: value
            type: b1
          - id: reserved
            type: b1 
          - id: filter
            type: b1
          - id: force
            type: b1
          - id: remote
            type: b1
          - id: comm
            type: b1 
          - id: restart
            type: b1
          - id: online
            type: b1

With error:

seq:
   - id: new
     type: object_1
      repeat: eos

types:
   object_1:
      seq:
         - id: value
           type: b1
         - id: quality
           type: object_quality_type

    object_quality_type:
        seq:
          - id: reserved
            type: b1 
          - id: filter
            type: b1
          - id: force
            type: b1
          - id: remote
            type: b1
          - id: comm
            type: b1 
          - id: restart
            type: b1
          - id: online
            type: b1
@GreyCat
Copy link
Member

GreyCat commented Jun 19, 2019

@jaroslaw-wieczorek The problem with this approach is that by default, nowadays Kaitai Struct treats all user types as byte aligned, thus your "with error" example actually reads two bytes, not one (value in the first byte, and reserved, filter, etc in the second byte) due to this alignment.

There's ongoing discussion on that in #12 — hopefully, we'll eventually provide means to specify bit-level alignment.

@GreyCat
Copy link
Member

GreyCat commented Jun 19, 2019

Please continue discussion in #12.

@generalmimon
Copy link
Member

Duplicate of #1070

@generalmimon generalmimon marked this as a duplicate of #1070 Oct 4, 2023
@generalmimon generalmimon closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants