summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorChad Brubaker <cbrubaker@google.com>2015-10-07 14:20:10 -0700
committerSteve Kondik <steve@cyngn.com>2015-11-05 21:16:19 -0800
commit0ea0ecfccc024853e27dd1322ba8c806ea247768 (patch)
tree37f0508d1765f94d5e34f4e2b8d7ae21e86fab36 /media/libmedia
parent90eadbb16b9d8bfef54e5a1b46e6106539b660de (diff)
downloadframeworks_av-0ea0ecfccc024853e27dd1322ba8c806ea247768.zip
frameworks_av-0ea0ecfccc024853e27dd1322ba8c806ea247768.tar.gz
frameworks_av-0ea0ecfccc024853e27dd1322ba8c806ea247768.tar.bz2
Fix benign unsigned overflow in AuidoTrackShared
fsanitize=integer adds unsigned checks to int32_t - uint32_t, force both operands to int32_t to avoid such checks being added. Change-Id: I76fce38f9636f5322ad95fdb81abb690503f4d08
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioTrackShared.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libmedia/AudioTrackShared.cpp
index 6a51a76..0f8e6d6 100644
--- a/media/libmedia/AudioTrackShared.cpp
+++ b/media/libmedia/AudioTrackShared.cpp
@@ -38,7 +38,7 @@ size_t clampToSize(T x) {
// In general, this means (new_self) returned is max(self, other) + 1.
static uint32_t incrementSequence(uint32_t self, uint32_t other) {
- int32_t diff = self - other;
+ int32_t diff = (int32_t) self - (int32_t) other;
if (diff >= 0 && diff < INT32_MAX) {
return self + 1; // we're already ahead of other.
}
@@ -893,7 +893,7 @@ ssize_t StaticAudioTrackServerProxy::pollPosition()
if (mObserver.poll(state)) {
StaticAudioTrackState trystate = mState;
bool result;
- const int32_t diffSeq = state.mLoopSequence - state.mPositionSequence;
+ const int32_t diffSeq = (int32_t) state.mLoopSequence - (int32_t) state.mPositionSequence;
if (diffSeq < 0) {
result = updateStateWithLoop(&trystate, state) == OK &&