Repository navigation
Conversation
flb_lua_pushmpack() read strings, binaries and extensions by advancing the reader position by the declared length, without checking it against the remaining data, and ignored reader errors, so truncated input read past the end of the buffer. Nesting was not limited and the Lua stack was not grown for nested tables. Read the bytes through the reader, which checks the length, fail on reader errors, limit nesting to 512 levels as JSON packing does, grow the Lua stack for every nested table, and leave the stack unchanged on failure. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Problem
flb_lua_pushmpack()pushes a MessagePack value read with mpack onto the Luastack. For strings, binaries and extensions it advanced
reader->databy thedeclared length without checking it against the remaining data, and it
ignored reader errors. A truncated value read past the end of the buffer.
Nesting had no limit, and nested tables were created without growing the Lua
stack.
Change
mpack_read_bytes_inplace(), which checks the length,and fail on any reader error.
Valid input decodes as before. The function keeps its signature.
Testing
New
lua_pushmpack_invalidcase intests/internal/lua.c:It fails on
masterand passes with this change.Summary by CodeRabbit