Skip to content

gzip: read magic number endian-safely in streaming decompressor [Backport to 4.2] - #12056

Merged
cosmo0920 merged 1 commit into
4.2from
out_stackdriver-fix-int64-build-4.2
Jul 6, 2026
Merged

gzip: read magic number endian-safely in streaming decompressor [Backport to 4.2]#12056
cosmo0920 merged 1 commit into
4.2from
out_stackdriver-fix-int64-build-4.2

Conversation

@cosmo0920

Copy link
Copy Markdown
Contributor

The gzip header magic was memcpy'd into a uint16_t and compared against 0x8B1F, which only holds on little endian hosts. On big endian targets (s390x) a valid stream was rejected with 'invalid magic bytes : 1f8b'. Read the field with read_le16() so the comparison works regardless of host byte order.

This PR is partially backporting of #12045 due to already fixed incompatible type on source_location_line.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

The gzip header magic was memcpy'd into a uint16_t and compared
against 0x8B1F, which only holds on little endian hosts. On big
endian targets (s390x) a valid stream was rejected with
'invalid magic bytes : 1f8b'. Read the field with read_le16() so
the comparison works regardless of host byte order.

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cosmo0920
cosmo0920 requested a review from edsiper as a code owner July 6, 2026 06:21
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed51998a-3684-4788-a5d9-51f3b3648555

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch out_stackdriver-fix-int64-build-4.2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cosmo0920
cosmo0920 merged commit a58c3a2 into 4.2 Jul 6, 2026
54 checks passed
@cosmo0920
cosmo0920 deleted the out_stackdriver-fix-int64-build-4.2 branch July 6, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants