Skip to content

flb_processor: fix numeric condition rule values not cast to double - #12395

Open
flobz wants to merge 1 commit into
fluent:masterfrom
flobz:fix/conditionals-cast
Open

flobz wants to merge 1 commit into
fluent:masterfrom
flobz:fix/conditionals-cast

Conversation

@flobz

@flobz flobz commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

When a condition rule uses GT/LT/GTE/LTE with an integer variant (CFL_VARIANT_INT or CFL_VARIANT_UINT), the value pointer was typed as int64_t*/uint64_t* but rule_create read it as double* via (double)value, producing a garbage comparison threshold.

Fix: convert INT and UINT variants to double at the call site before passing the address to flb_condition_add_rule, so the callee always receives a proper double*.


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 numeric condition handling for integer and unsigned-integer values by ensuring they are processed consistently as floating-point numbers.

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bf4180bf-7c14-4424-beae-554dc52b07b8

📥 Commits

Reviewing files that changed from the base of the PR and between 708724d and c98ec2e.

📒 Files selected for processing (1)
  • src/flb_processor.c

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

flb_processor_unit_set_condition now converts integer and unsigned-integer condition rule values to double before passing them to downstream condition rules.

Changes

Condition value conversion

Layer / File(s) Summary
Convert numeric condition values
src/flb_processor.c
The processor stores integer and unsigned-integer rule values in a local double variable and passes that value to the downstream condition rule.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 48a88

Numeric condition thresholds now use the expected representation, with no unresolved material risk identified in the changed path.

🚥 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 and concisely describes the main change: casting numeric condition rule values to double in flb_processor.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

When a condition rule uses GT/LT/GTE/LTE with an integer variant
(CFL_VARIANT_INT or CFL_VARIANT_UINT), the value pointer was typed as
int64_t*/uint64_t* but rule_create read it as double* via *(double*)value,
producing a garbage comparison threshold.

Converts INT and UINT variants to double at the call site before
passing the address to flb_condition_add_rule, so the callee always
receives a proper double*.

Signed-off-by: Florian <florian.bezannier@hotmail.fr>
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