summaryrefslogtreecommitdiff
path: root/trusty/coverage/coverage_test.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-08-23 09:09:40 -0700
committerTom Cherry <tomcherry@google.com>2019-08-23 14:58:14 -0700
commitbe0f4abfaff2f88645bc709b686619a00977e782 (patch)
tree0bffb2718c006663b3589337f77c4851662694b6 /trusty/coverage/coverage_test.cpp
parent3bd09415a3f859467fae2b1516ffa3e95431bfa0 (diff)
logd: Allow setDropped() to be called on already dropped messages
rprichard@ pointed out a bug where LogBufferElement::setDropped() reallocates mMsg to the size of mMsgLen in the case where getTag() != 0. However, mMsgLen is in a union with mDroppedCount and mDroppedCount is the value used when a message is already dropped. Therefore, it's possible that logd uses the wrong value and allocates much more memory than intended. We do call setDropped() on elements that have already been dropped in LogBufferElementLast::coalesce(), so this is not a superfluous issue. To simplify this even more, this code puts an mTag in a union with mMsg, such that if mDropped is true, there will never be an allocated message; mTag will be directly referred to instead. This also reduces the number of allocations needed very slightly. Test: logd/liblog/logcat unit tests. Change-Id: Ia1bfba076439fe31c745a243283d41902bca45ac
Diffstat (limited to 'trusty/coverage/coverage_test.cpp')
0 files changed, 0 insertions, 0 deletions