[OpenJDK 2D-Dev] [9] request for review: 8074954: ImageInputStreamImpl.readShort/readInt do not behave correctly at EOF
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Fri Mar 20 17:32:52 UTC 2015
Hi, Andrew?
Hi, Andrew.
Should we update a readFully() also?
* @exception java.io.EOFException if the stream reaches the end before
* reading all the bytes.
* @exception IOException if an I/O error occurs.
*/
void readFully(byte[] b, int off, int len) throws IOException;
20.03.15 14:30, Andrew Brygin wrote:
> Hello,
>
> could you please review a fix for CR 8074954?
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8074954
> Webrev: http://cr.openjdk.java.net/~bae/8074954/9/webrev.00/
>
> The problem happens if an input stream does not contain enough data
> to read a multi-byte type (as 4-bytes integer or 2-bytes short)
> completely. In this case the actual number of obtained bytes is
> returned, and if we get at least one byte, the EOF exception in
> not triggered.
> As a result, an incorrect value is returned.
>
> Suggested fix is to check explicitly whether required number of bytes
> has been read.
>
> Supplied regression test demonstrates the problem.
>
> Please take a look.
>
> Thanks,
> Andrew.
--
Best regards, Sergey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20150320/fe96b307/attachment.html>
More information about the 2d-dev
mailing list