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

ReadContentInputStream.read() method returning wrong values #2800

Open
lfcnassif opened this issue Feb 10, 2023 · 1 comment · May be fixed by #2834
Open

ReadContentInputStream.read() method returning wrong values #2800

lfcnassif opened this issue Feb 10, 2023 · 1 comment · May be fixed by #2834

Comments

@lfcnassif
Copy link
Contributor

lfcnassif commented Feb 10, 2023

The InputStream.read() contract says it should return a byte as an unsigned int in [0, 255] range when EOF is not reached. The current implementation is:
https://github.com/sleuthkit/sleuthkit/blob/sleuthkit-4.12.0/bindings/java/src/org/sleuthkit/datamodel/ReadContentInputStream.java#L41-L42

Last line should be fixed to:
return (read(buff) != -1) ? buff[0] & 0xFF : -1;

@lfcnassif
Copy link
Contributor Author

lfcnassif commented Feb 10, 2023

This method is returning wrong values and can signal EOF before reaching it.

@lfcnassif lfcnassif changed the title Bug in ReadContentInputStream.read() method can signal false EOF early Bug in ReadContentInputStream.read() method returning wrong values Feb 10, 2023
@lfcnassif lfcnassif changed the title Bug in ReadContentInputStream.read() method returning wrong values ReadContentInputStream.read() method returning wrong values Feb 12, 2023
lfcnassif added a commit to sepinf-inc/sleuthkit that referenced this issue Jun 21, 2023
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

Successfully merging a pull request may close this issue.

1 participant