Skip to content

compat: Ensure alignment of reading dword width - #12276

Open
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-segv-on-sb
Open

compat: Ensure alignment of reading dword width#12276
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-plug-segv-on-sb

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Sometimes, static inline uint32_t FLB_ALIGNED_DWORD_READ(unsigned char *source) function causes SEGV.
This is because just reading the bare pointer of unsigned char *source does not ensure the alignment.


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.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility when reading unaligned data on platforms without strict alignment enforcement.
    • Prevented potential memory access issues by using safer byte-copy operations.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9744ca7-4def-42f0-b858-e4e3c82f3fe2

📥 Commits

Reviewing files that changed from the base of the PR and between ae51533 and 3882ca0.

📒 Files selected for processing (1)
  • include/fluent-bit/flb_compat.h

📝 Walkthrough

Walkthrough

The compatibility header adds the required string library include and updates non-aligned DWORD reads to copy four bytes into a uint32_t with memcpy.

Changes

Aligned DWORD reads

Layer / File(s) Summary
Memcpy-based DWORD read
include/fluent-bit/flb_compat.h
Adds <string.h> and replaces the potentially unaligned pointer dereference with memcpy into a local uint32_t result.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 3882c

This is a localized compatibility change, and no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: edsiper, leonardo-albertovich

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: ensuring aligned 32-bit reads in the compatibility code.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-plug-segv-on-sb

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3882ca0677

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread include/fluent-bit/flb_compat.h
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
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.

1 participant