Fix AudioFlinger crash after playing overnight.
Track position overflows max int and that lead to check crash.
Add logic to covert position to a reasonable value in AudioFlinger
to avoid this crash.
PD#SWPL-68459
Bug: 297141696
Test: manual
U + ohm
Change-Id: Ifa70d1c196599f779947c0e9762f119156329136
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 31246ec..2dd039a 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -451,6 +451,10 @@
if (*_aidl_return != OK) {
return Status::ok();
}
+
+ // restrict position modulo INT_MAX to avoid integer sanitization abort
+ legacy.mPosition &= INT_MAX;
+
*timestamp = legacy2aidl_AudioTimestamp_AudioTimestampInternal(legacy).value();
return Status::ok();
}