Copilot commented on code in PR #11251:
URL: https://github.com/apache/ozone/pull/11251#discussion_r4040256459


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/OzoneCryptoInputStream.java:
##########
@@ -136,6 +153,141 @@ keyName, partIndex, getLength(), numBytesToRead,
     return numBytesRead;
   }
 
+  @Override
+  public synchronized int read(ByteBuffer buf) throws IOException {
+    return super.read(buf);
+  }

Review Comment:
   `CryptoInputStream` also exposes `read(ByteBufferPool, int, 
EnumSet<ReadOption>)`, which can seek the wrapped stream and mutate 
`outBuffer`/`streamOffset`. Because that inherited sequential-read path is not 
synchronized here, it can still interleave with this class's seek-read-restore 
critical section and corrupt a positioned read. Override that overload with the 
same `synchronized` monitor (and cover it in the concurrency test).



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to