masteryhx commented on code in PR #24847:
URL: https://github.com/apache/flink/pull/24847#discussion_r1615702417
##########
flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/fs/ByteBufferReadableFSDataInputStream.java:
##########
@@ -99,7 +104,23 @@ public int readFully(ByteBuffer bb) throws IOException {
public int readFully(long position, ByteBuffer bb) throws Exception {
if (bb == null) {
throw new NullPointerException();
- } else if (bb.remaining() == 0) {
+ } else if (position > totalFileSize) {
+ throw new IllegalArgumentException(
+ String.format(
+ "position [%s] is larger than totalFileSize [%s]",
+ position, totalFileSize));
+ }
+
+ // Avoid bb.remaining() exceeding the file size limit.
+ bb.limit(
Review Comment:
It just follws `ByteBufferReadable` as we set `limit` before calling it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]