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
Loading
Please register or sign in to comment