Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2adbece1 authored by Tom Cherry's avatar Tom Cherry
Browse files

logd: Fix ClearUidLogs() when writer_active_ is true

Previously ClearUidLogs() would Compress() the log buffer in all
cases, however that is the wrong behavior when writer_active_ is true
and would leave the SerializedLogChunk object in an invalid state.  If
more logs are written to the log, then write_offset() will be higher
than the compressed size of the log, violating a CHECK() when later
decompressing the log.

This change does not call Compress() in ClearUidLogs() if
writer_active_ is true.  It upgrades a check in Compress() from a
simple if statement to a CHECK() to prevent against this happening in
the future.

It adds a test that exercises the previously failing path.

Bug: 166187079
Test: unit tests
Change-Id: Ic5fbcf16f724af1c20170b8f4e6e2daadf6a9529
parent 29e7b2af
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment