On Mon, 28 Mar 2022 15:01:30 GMT, Jaikiran Pai <[email protected]> wrote:
>> Volker Simonis has refreshed the contents of this pull request, and previous
>> commits have been removed. The incremental views will show differences
>> compared to the previous content of the PR. The pull request contains one
>> new commit since the last revision:
>>
>> 8282648: Problems due to conflicting specification of
>> Inflater::inflate(..) and InflaterInputStream::read(..)
>
> src/java.base/share/classes/java/util/zip/InflaterInputStream.java line 133:
>
>> 131: * Unlike the {@link InputStream#read(byte[],int,int) overridden
>> method}
>> 132: * of {@code InputStream}, this method might write more bytes than
>> the returned
>> 133: * number of inflated bytes into the buffer {@code b}.
>
> Hello Volker, I think this comment should be a bit more clear and state what
> exactly it means by writing more bytes than the returned value. Specifically,
> I think it should clearly state that even though it might write additional
> data, it will however not write/change data starting and beyond `off + len`
> index in the passed array.
I think this require a bit of word smithing. If the return value is 'n' then it
should make it clear that the values in elements b[off + n] to b[off + len - 1]
are undefined, their values may or may have been changed by the inflate/read
operation. For completeness, the expectation for when inflate fails should be
specified too, the contents of b[off] to b[off + len - 1] will be undefined.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7986