Repository navigation
Conversation
Signed-off-by: Ugur Guenduez <ugur.guenduez@mercedes-benz.com>
Signed-off-by: Ugur Guenduez <ugur.guenduez@mercedes-benz.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe JSON serializer now rejects zero-sized buffers, permits exact fits, reserves space for a null terminator, and has tests for capacity boundaries, output integrity, and sentinel preservation. ChangesJSON buffer capacity handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
flb_msgpack_to_json()rejects a buffer containing exactly enough space for the JSON output plus its NUL terminator: converting MessagePack nil tonullcurrently needs six bytes instead of five. The wrapper already reserves one byte, buttry_to_write()rejects equality against the remaining payload capacity, effectively reserving another byte.Allow literal writes to fill that payload capacity while keeping
json_size - 1for every writer. Reject zero-sized buffers before the subtraction and terminator write. Passing the full buffer capacity instead would allow a string writer to consume the terminator slot and cause the wrapper to write one byte past the buffer on failure.Regression coverage sweeps capacities from zero through one byte beyond exact fit for 16 MessagePack inputs in both Unicode modes, including literals, escaped and long strings, binary/extension values, and nested containers. It checks return values, exact output, termination, and canaries on both sides. Restoring the old comparison fails the exact-fit assertions; substituting the full-capacity proposal fails the boundary canaries.
Related finding: #12313 (comment). This PR is based directly on upstream master and is independent of the iterative traversal fix in #12313.
Testing
ok-package-testlabel (no packaging changes).Built with internal/runtime tests enabled and the tail, dummy, lib, storage_backlog, Loki, and null plugins. Validation on Linux:
Documentation
Backporting
Fluent Bit is licensed under Apache 2.0; this contribution is submitted under that license.
Summary by CodeRabbit
Bug Fixes
Tests