From 9767a47dcf9bbe090045ab99e0290d73289c704f Mon Sep 17 00:00:00 2001
From: Wei Jia <wjia@google.com>
Date: Thu, 16 Apr 2015 15:02:13 -0700
Subject: MediaSync: sanity check native sample rate.

Bug: 19666434
Change-Id: I0eb7a70c81c4fcc336f52f014eeb6d261ac2c501
---
 media/libstagefright/MediaSync.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/media/libstagefright/MediaSync.cpp b/media/libstagefright/MediaSync.cpp
index 7b6c7d9..ec956c4 100644
--- a/media/libstagefright/MediaSync.cpp
+++ b/media/libstagefright/MediaSync.cpp
@@ -115,6 +115,11 @@ status_t MediaSync::configureAudioTrack(
         return INVALID_OPERATION;
     }
 
+    if (audioTrack != NULL && nativeSampleRateInHz <= 0) {
+        ALOGE("configureAudioTrack: native sample rate should be positive.");
+        return BAD_VALUE;
+    }
+
     mAudioTrack = audioTrack;
     mNativeSampleRateInHz = nativeSampleRateInHz;
 
-- 
cgit v1.1