Bug 66511 - GZipOutputFilter overwrites chunk instead of reading it
Summary: GZipOutputFilter overwrites chunk instead of reading it
Alias: None
Product: Tomcat 10
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 10.1.7
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ------
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2023-03-06 11:26 UTC by Arjen Poutsma
Modified: 2023-03-06 14:35 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Arjen Poutsma 2023-03-06 11:26:17 UTC
In GzipOutputFilter::doWrite, if the given ByteBuffer is not backed by an array, it gets overwritten with empty data. 

See https://github.com/apache/tomcat/blob/main/java/org/apache/coyote/http11/filters/GzipOutputFilter.java#L73

Suggested solution:

Replace ByteBuffer::put with ByteBuffer::get.
Comment 1 Mark Thomas 2023-03-06 14:35:20 UTC
Thanks for reporting this.

Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
-  9.0.x for  9.0.74 onwards
-  8.5.x for  8.5.88 onwards