Skip to content

Commit

Permalink
8326099: GZIPOutputStream should use Deflater.getBytesRead() instead …
Browse files Browse the repository at this point in the history
…of Deflater.getTotalIn()

Reviewed-by: jpai
  • Loading branch information
Eirik Bjørsnøs committed Feb 26, 2024
1 parent 490825f commit bb6b048
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ private void writeHeader() throws IOException {
*/
private void writeTrailer(byte[] buf, int offset) throws IOException {
writeInt((int)crc.getValue(), buf, offset); // CRC-32 of uncompr. data
writeInt(def.getTotalIn(), buf, offset + 4); // Number of uncompr. bytes
// RFC 1952: Size of the original (uncompressed) input data modulo 2^32
int iSize = (int) def.getBytesRead();
writeInt(iSize, buf, offset + 4);
}

/*
Expand Down

1 comment on commit bb6b048

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.