[ https://issues.apache.org/jira/browse/HDFS-10254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15223455#comment-15223455 ]
Steve Loughran commented on HDFS-10254: --------------------------------------- If you pass in a negative buffer offset, such as {{instream.read(0, buffer, 0, -16)}}, things misbehave; if you have JVM asserts on you get a message {code} java.lang.AssertionError: Wrong number of bytes read. at org.apache.hadoop.hdfs.DFSInputStream.pread(DFSInputStream.java:1534) at org.apache.hadoop.hdfs.DFSInputStream.read(DFSInputStream.java:1482) at org.apache.hadoop.fs.FSDataInputStream.read(FSDataInputStream.java:92) at org.apache.hadoop.fs.contract.AbstractContractSeekTest.testReadSmallFile(AbstractContractSeekTest.java:459) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {code} > DfsClient undervalidates args for PositionedReadable operations > --------------------------------------------------------------- > > Key: HDFS-10254 > URL: https://issues.apache.org/jira/browse/HDFS-10254 > Project: Hadoop HDFS > Issue Type: Bug > Components: hdfs-client > Affects Versions: 2.8.0 > Reporter: Steve Loughran > > HDFS should can do stricter checking of the inputs > # raise an exception on negative offset of destination buffer > # explicitly raise an EOF exception if the file position is negative > Optionally: short-circuit read/readfully operations if the byte range is 0. -- This message was sent by Atlassian JIRA (v6.3.4#6332)