diff options
author | Tom Cherry <tomcherry@google.com> | 2020-09-09 20:13:18 +0000 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2020-09-09 20:26:59 +0000 |
commit | 2adbece108c0f29dd417216173176c016440e1e5 (patch) | |
tree | 7c34accc2a9f07910387cfae3bcaa62daafb1293 /libutils/Unicode.cpp | |
parent | 29e7b2af306c69a3e121bca1830a642eeac64019 (diff) |
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
Diffstat (limited to 'libutils/Unicode.cpp')
0 files changed, 0 insertions, 0 deletions