UI: Address logging buffer size discrepancies #10787
Merged
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.
Description
Changes the remaining log buffer allocations in the log handler to use a buffer of size 8192 instead of 4096. Also adds improved string handling in the form of using
strncpy
rather thanstrcpy
in thetoo_many_repeated_entries()
check.Motivation and Context
OBS was crashing on startup when logging messages over 4096 characters in length with corruption of the
QPointer
object for the log viewer. It turns out that this was due to a buffer overrun in the log handling code.43a1b30 changed the size of the log buffer in obs-app.cpp's
do_log
, but to change the size of the buffer properly we need to also modify the buffer size in the subsequent check for repeated entries, as well as the base log handler inlibobs
. Otherwise the repeated entries check will bulldoze over memory adjacent tocmp_str
if fed a message exceeding 4096 characters in length, as well as other memory in the base log handler.How Has This Been Tested?
Verified that OBS no longer crashes when failing to load VLC on startup, and logging continues to work correctly.
Types of changes
Checklist: