RFR: 8323562: SaslInputStream.read() may return wrong value

Jaikiran Pai jpai at openjdk.org
Fri Jan 12 12:05:20 UTC 2024


On Thu, 11 Jan 2024 06:28:51 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> SaslInputStream.read() should return a value in the range from 0 to 255 per the spec of InputStream.read() but it returns the signed byte from the inBuf as is.

src/java.naming/share/classes/com/sun/jndi/ldap/sasl/SaslInputStream.java line 83:

> 81:             return inBuf[0] & 0xff;
> 82:         } else {
> 83:             return -1;

As a separate follow up, even this else block might need some review on whether `count` can practically be 0 here and if so whether it's OK to return -1 (implying EOF) in such cases.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17365#discussion_r1450341455


More information about the core-libs-dev mailing list