Repository navigation
[piper] do not index past the end for an empty demuxed body - #1765
Open
akashchamp wants to merge 1 commit into
Open
akashchamp wants to merge 1 commit into
akashchamp wants to merge 1 commit into
Conversation
When a demuxed line has an empty body, like a blank docker-compose line "db-1 | ", the memcpy() destination in piper_log_format::get_subline() was &plf_cached_line[prefix_len], which is one past the end of the vector. Builds with -D_GLIBCXX_ASSERTIONS (Arch Linux, for one) abort on that. Use data() + prefix_len instead. Fixes tstack#1759
This branch has not been deployed
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 #1759.
When the first line of a docker-compose log has an empty body (
db-1 |),piper_log_format::get_subline()copies zero bytes to&plf_cached_line[prefix_len], which is one past the end of the vector. Release builds don't notice, but builds with-D_GLIBCXX_ASSERTIONS(like Arch's package) abort. This switches the destination toplf_cached_line.data() + prefix_len, same as the #1505 fix.Added
test/logfile_docker_compose_empty_body.0and a case intest_demux.shfor it.Verification, on Ubuntu 24.04 / GCC 13 with
CXXFLAGS="-O1 -g -Wp,-D_GLIBCXX_ASSERTIONS":printf 'a | \n' > t.log && lnav -n t.loghitsAssertion '__n < this->size()' failedinstl_vector.h, and the newtest_demux.shcase fails with the same assertion.make check TESTS=test_demux.shpasses.make -k -C test check: 54/56 pass.test_sessions.shandtest_sql.shfail only because this machine has nosqlite3CLI (timeout: failed to run command 'sqlite3').