Merge "Fix AudioFlinger crash after playing overnight." into main am: 85ee025ddb am: 98f296ec70 am: 9e37c6fc49

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2827570

Change-Id: If788d7c005ae1212cdc486a4de642de359859173
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 5b426a5..fe582eb 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -450,6 +450,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();
 }