Fix overflow sanitizer in copyWithAuthor.
An array index calculation in NBLog.cpp causes a runtime error on
integer overflow sanitized builds.
buffer[sizeof(buffer) + Entry::kPreviousLengthOffset] = ...
runtime error: unsigned integer overflow: 27 + 4294967295 cannot be
represented in type 'unsigned int'
This changes kPreviousLengthOffset to signed, which provides the same
effect without the overflow.
Bug: 30969751
Test: Compiles, device boots.
Change-Id: I25b232bba6a1940674d15a06483b2595eecc29e8
diff --git a/media/libnblog/include/media/nblog/NBLog.h b/media/libnblog/include/media/nblog/NBLog.h
index ebb88f0..fb6f179 100644
--- a/media/libnblog/include/media/nblog/NBLog.h
+++ b/media/libnblog/include/media/nblog/NBLog.h
@@ -236,7 +236,7 @@
// mEvent, mLength, mData[...], duplicate mLength
static const size_t kOverhead = sizeof(entry) + sizeof(ending);
// endind length of previous entry
- static const size_t kPreviousLengthOffset = - sizeof(ending) +
+ static const ssize_t kPreviousLengthOffset = - sizeof(ending) +
offsetof(ending, length);
};