Repository navigation
Conversation
hit() copied matched strings into a fixed 128-byte stack buffer, so any string longer than 127 chars printed by rz-find -Z got cut off (issue rizinorg#6289: a C++ mangled symbol name from LIEF got chopped mid-identifier). The same fixed-size loop also read ro->buf[delta + i] without checking it stayed inside the bsize-sized block that was actually read, an out-of-bounds read for hits near the end of a block smaller than the buffer. Grow the buffer to 4096 bytes and bound the copy loop by the number of bytes actually available in the current block (ro->bsize - delta), fixing both the truncation and the latent OOB read. Verified against the exact binary from the issue (bins/elf/0pack in rizin-testbins): the previously truncated symbol names now print in full and match rz's own izz output.
kisnner26
requested review from
Rot127,
b1llow,
kazarmy,
notxvilka,
ret2libc,
thestr4ng3r and
wargio
as code owners
September 18, 2026 09:49
Member
|
It is not allowed to use AI for a good-first-issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #6289
hit()copies each matched string into a fixed 128-byte stack buffer (char _str[128]), sorz-find -Zcuts off any string longer than 127 characters. That's exactly what the issue shows: C++ mangled symbol names from LIEF (_ZN4LIEF7Android16ANDROID_VERSION...) get chopped mid-identifier, while the same strings print in full throughizz.The same loop also reads
ro->buf[delta + i]without checking that stays inside the block that was actually read intoro->buf(sizedro->bsize, user-adjustable with-b), so a hit near the end of a block smaller than the string buffer can read past the allocation.This PR:
min(sizeof(buffer)-1, ro->bsize - delta), fixing the truncation and the latent out-of-bounds read in the same changebins/elf/0packin rizin-testbins), asserting the previously-truncated symbol names now print in full and match rz's ownizzoutput for the same stringsverified locally: built with meson/ninja, ran
rz-find -s Android -Z bins/elf/0packbefore/after — confirmed the 130-char mangled names were truncated on master and print in full with this fix, matchingizzexactly. Ran the fulltest/db/tools/rz_findsuite against rizin-testbins; the new test passes and no other test regresses (a handful of pre-existing unrelated tests fail in my local setup due to the magic DB / PATH not being installed system-wide, not from this change).