Skip to content

pack: msgpack_append_message: Process boundary conditions strictly for extending msgpack maps#11536

Open
cosmo0920 wants to merge 5 commits intomasterfrom
cosmo0920-process-boundary-conditions-strictly-for-extending-msgpack-maps
Open

pack: msgpack_append_message: Process boundary conditions strictly for extending msgpack maps#11536
cosmo0920 wants to merge 5 commits intomasterfrom
cosmo0920-process-boundary-conditions-strictly-for-extending-msgpack-maps

Conversation

@cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Mar 11, 2026


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

    • Added overflow protection for large buffer operations to prevent size-related errors.
  • Refactor

    • Updated function parameter types to better handle larger message and buffer sizes across the codebase.
    • Note: This includes a breaking API change for flb_msgpack_expand_map() function—callers must update their code to use the new parameter types.

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@cosmo0920 cosmo0920 requested a review from edsiper as a code owner March 11, 2026 09:59
@cosmo0920 cosmo0920 added this to the Fluent Bit v5.0 milestone Mar 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ebc8734c-b00a-4052-8cd2-68ed12293307

📥 Commits

Reviewing files that changed from the base of the PR and between a1d9c2a and ca2dfa9.

📒 Files selected for processing (6)
  • include/fluent-bit/flb_pack.h
  • plugins/filter_parser/filter_parser.c
  • plugins/in_syslog/syslog_prot.c
  • plugins/in_udp/udp_conn.c
  • src/flb_msgpack_append_message.c
  • src/flb_pack.c

📝 Walkthrough

Walkthrough

Fluent-bit updates its public API and internal implementations to widen size-related parameters from int to size_t, affecting the flb_msgpack_expand_map function and related code paths across the core and plugin modules. Overflow guards are added to prevent size_t arithmetic overflows.

Changes

Cohort / File(s) Summary
Public API Header
include/fluent-bit/flb_pack.h
Function signature updated: obj_arr_len parameter changed from int to size_t, and out_size parameter changed from int* to size_t*.
Core Implementation
src/flb_pack.c
Function implementation updated to match new signature; added #include <stdint.h> and #include <limits.h>; internal variables (map_num, i, len) changed to size_t; overflow guards added for kv_arr_len and map_num bounds checking; msgpack_pack_map call casted to uint32_t.
Plugin Updates
plugins/filter_parser/filter_parser.c, plugins/in_syslog/syslog_prot.c, plugins/in_udp/udp_conn.c, src/flb_msgpack_append_message.c
Local variable modified_data_size (or new_size) changed from int to size_t to align with size semantics and handle larger buffer sizes correctly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

docs-required, backport to v4.1.x

Suggested reviewers

  • edsiper
  • koleini
  • stoksc
  • alecholmes

Poem

🐰 From int to size\_t, we venture far,
Guarding overflows like a northern star,
Wider types now hold the truth,
Protecting memory, preserving youth! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the PR: converting integer types to size_t for proper boundary condition handling in msgpack map extension operations across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cosmo0920-process-boundary-conditions-strictly-for-extending-msgpack-maps

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 and usage tips.

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.

1 participant