sleuthkit / sleuthkit

The Sleuth Kit® (TSK) is a library and collection of command line digital forensics tools that allow you to investigate volume and file system data. The library can be incorporated into larger digital forensics tools and the command line tools can be directly used to find evidence.

Home Page:http://www.sleuthkit.org/sleuthkit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReadContentInputStream.read() method returning wrong values

lfcnassif opened this issue · comments

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;

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