Merge "Add INT64_MIN check in MPEG4Writer sample validate" into main
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index bc1a97c..d50c06b 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -2454,6 +2454,11 @@
         return true;
     }
 
+    // Make sure abs(timeUs) does not overflow
+    if (timeUs == INT64_MIN) {
+       return false;
+    }
+
     // Ensure that the timeUs value does not have extremely low or high values
     // that would cause an underflow or overflow, like in the calculation -
     // mdhdDuration = (trakDurationUs * mTimeScale + 5E5) / 1E6