Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gzip decoding when FLG.FHCRC is set #11805

Merged
merged 2 commits into from Oct 29, 2021
Merged

Fix gzip decoding when FLG.FHCRC is set #11805

merged 2 commits into from Oct 29, 2021

Conversation

AL333Z
Copy link
Contributor

@AL333Z AL333Z commented Oct 28, 2021

 

Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.

If FHCRC is set, a CRC16 for the gzip header is present,
immediately before the compressed data. The CRC16 consists
of the two least significant bytes of the CRC32 for all
bytes of the gzip header up to and not including the CRC16.

The current implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 

Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.

Related: http4s/http4s#5417

 
Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.
> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.

The implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 
Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.
@normanmaurer
Copy link
Member

@AL333Z also please sign our ICLA: https://netty.io/s/icla ... And thanks for the contribution!

@AL333Z
Copy link
Contributor Author

AL333Z commented Oct 28, 2021

Hi @normanmaurer, I already signed the ICLA before raising this PR.

@normanmaurer normanmaurer added this to the 4.1.70.Final milestone Oct 28, 2021
@normanmaurer normanmaurer merged commit 2a028dd into netty:4.1 Oct 29, 2021
@normanmaurer
Copy link
Member

@AL333Z Thanks a lot!

@AL333Z AL333Z deleted the fix-gzip-decoder-with-FHCRC-set branch October 29, 2021 08:01
normanmaurer pushed a commit that referenced this pull request Oct 29, 2021
 
Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.
> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.

The implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 
Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this pull request Dec 16, 2021
 
Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.
> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.

The implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 
Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.
laosijikaichele pushed a commit to laosijikaichele/netty that referenced this pull request Dec 16, 2021
 
Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.
> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.

The implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 
Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.
raidyue pushed a commit to raidyue/netty that referenced this pull request Jul 8, 2022
 
Motivation:

The current implementation is not respecting the spec at https://www.ietf.org/rfc/rfc1952, section 2.3.
> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.

The implementation is reusing the CRC32 logic without taking the two least significant bytes.

Modifications:

Use a method that respects the spec.
 
Result:

When the FLG.FHCRC bit is set, the correct verification algorithm will be used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants