Libin Qin created FLINK-32509: --------------------------------- Summary: avoid using skip in InputStreamFSInputWrapper.seek Key: FLINK-32509 URL: https://issues.apache.org/jira/browse/FLINK-32509 Project: Flink Issue Type: Bug Components: API / Core Affects Versions: 1.18.0 Reporter: Libin Qin
The implementation of InputStream does not return -1 for eof. The java doc of InputStream said "The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0." For FileInputStream, it allows skipping any number of bytes past the end of the file. So the method "seek" of InputStreamFSInputWrapper will cause infinite loop if desired exceed end of file I reproduced with following case ```java byte[] bytes = "flink".getBytes(); try (InputStream inputStream = new ByteArrayInputStream(bytes)) { InputStreamFSInputWrapper wrapper = new InputStreamFSInputWrapper(inputStream); wrapper.seek(20); } ``` I found an issue of commons-io talks about the problem of skip https://issues.apache.org/jira/browse/IO-203 -- This message was sent by Atlassian Jira (v8.20.10#820010)