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

AFPInputStream does not handle structured field length correctly #65

Open
michaelknigge opened this issue Feb 18, 2022 · 0 comments
Open

Comments

@michaelknigge
Copy link

The AFPInputStream throws an AfpFormatException("premature end of file.") if the first or second byte of the structured field length is 0xFF.

If the first byte is a 0xFF the file is "broken" of course, but the second byte can be 0xFF... In my test case I have a file where a record begins with 5A1FFF

The fix is quite simple... In AFPInputStream please have a look at the method read. Just replace return header[(int) offset]; with return header[(int) offset] & 0xff;

bye,
Michael

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

1 participant