Repository navigation
fix: discard oversized syslog records through their delimiter - #218
Merged
huami1314 merged 1 commit intoDec 3, 2026
Merged
Conversation
Afloat16
marked this pull request as ready for review
December 2, 2026 13:29
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.
Problem
The device syslog reader intends to discard records larger than 64 KiB. It currently clears the buffer after the 65,537th non-CR byte, then starts buffering the rest of the same record. Its next LF or NUL therefore publishes that suffix as if it were a complete log record. For example, 65,537
abytes followed bytail\nemittailto the log callback.Change
Keep a discard state until the oversized record's LF or NUL delimiter, including across socket reads. The next complete record is processed normally. Move this small framing loop into a shared private module so its exact production implementation can be tested on the host without a device connection.
The existing budget counts raw bytes after CR removal. Exactly 65,536 bytes remain valid, CR handling and LF/NUL framing keep their existing behavior, and incomplete records at EOF are still left unreported. UTF-8 decoding and the C callback stay at the existing device call site. Checking the bound before appending also avoids growing the buffer just to discard it.
Validation
lib.rstest target on Linux gives 9 passed, including the three existing session-lifecycle tests.git diff --checkand formatting of the new Rust module pass.The reproducible original-loop/candidate driver is available in the validation branch.
The upstream Build IPA workflow passed on
38f2cd5606819e44f174134aa2b31581f5736a67, including the native device console build and the application IPA build. Local validation covers record framing and the host session tests; live-device pairing and capture have not been exercised.