bvaradar commented on a change in pull request #1616:
URL: https://github.com/apache/incubator-hudi/pull/1616#discussion_r429392893
##########
File path:
hudi-common/src/main/java/org/apache/hudi/common/fs/inline/InLineFsDataInputStream.java
##########
@@ -56,24 +56,29 @@ public long getPos() throws IOException {
@Override
public int read(long position, byte[] buffer, int offset, int length) throws
IOException {
+ if ((length - offset) > this.length) {
+ throw new IOException("Attempting to read past inline content");
+ }
return outerStream.read(startOffset + position, buffer, offset, length);
}
@Override
public void readFully(long position, byte[] buffer, int offset, int length)
throws IOException {
+ if ((length - offset) > this.length) {
+ throw new IOException("Attempting to read past inline content");
+ }
outerStream.readFully(startOffset + position, buffer, offset, length);
}
@Override
public void readFully(long position, byte[] buffer)
throws IOException {
- outerStream.readFully(startOffset + position, buffer, 0, buffer.length);
+ readFully(position, buffer, 0, buffer.length);
}
@Override
public boolean seekToNewSource(long targetPos) throws IOException {
Review comment:
@nsivabalan : Can we do bounds check first and throw error if it fails
then delegate. Even if it is a different copy, the offsets are expected to be
consistent across copies.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]