Merge "Fix integer overflow and divide-by-zero" into klp-dev am: b264ece2c0 am: bbca2719c6 am: c2e69851ea am: 3285770d37 am: d935c7f16e am: 98ee832c7e am: 1db2ee3dbd
am: 946a690f5c
Change-Id: I265078e7cab77a8865862f3b0319bfb0746ee814
diff --git a/media/libstagefright/AMRExtractor.cpp b/media/libstagefright/AMRExtractor.cpp
index a6fb3d8..9c07403 100644
--- a/media/libstagefright/AMRExtractor.cpp
+++ b/media/libstagefright/AMRExtractor.cpp
@@ -253,7 +253,7 @@
int64_t seekTimeUs;
ReadOptions::SeekMode mode;
- if (options && options->getSeekTo(&seekTimeUs, &mode)) {
+ if (mOffsetTableLength > 0 && options && options->getSeekTo(&seekTimeUs, &mode)) {
size_t size;
int64_t seekFrame = seekTimeUs / 20000ll; // 20ms per frame.
mCurrentTimeUs = seekFrame * 20000ll;
diff --git a/media/libstagefright/NuMediaExtractor.cpp b/media/libstagefright/NuMediaExtractor.cpp
index f24cf3a..6de2bb3 100644
--- a/media/libstagefright/NuMediaExtractor.cpp
+++ b/media/libstagefright/NuMediaExtractor.cpp
@@ -542,7 +542,7 @@
}
off64_t size;
- if (mDurationUs >= 0 && mDataSource->getSize(&size) == OK) {
+ if (mDurationUs > 0 && mDataSource->getSize(&size) == OK) {
*bitrate = size * 8000000ll / mDurationUs; // in bits/sec
return true;
}