summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorEmilian Peev <epeevs@codeaurora.org>2016-01-07 19:59:54 +0100
committercodeworkx <codeworkx@cyanogenmod.org>2016-01-07 19:59:54 +0100
commitb07beb7bd768aad9a40f306a564b966b5bea95ef (patch)
tree84da4dee1cd2d887b4e224995d631d0d1cf42154 /src/com/android
parent202b3c2a2dc9a12dc002e161be65364070535638 (diff)
downloadandroid_packages_apps_Snap-b07beb7bd768aad9a40f306a564b966b5bea95ef.tar.gz
android_packages_apps_Snap-b07beb7bd768aad9a40f306a564b966b5bea95ef.tar.bz2
android_packages_apps_Snap-b07beb7bd768aad9a40f306a564b966b5bea95ef.zip
Snapdragon Camera: Check mosaic preview dimensions
The preview dimensions used during the Mosaic libray initialization should be verified. Using invalid values like "0x0" could result in a crash of the JNI library. Change-Id: I812b9d1cb3cf6e664eaa582ee553d3af08d02bcb
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 0b2880c37..06e9710f4 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -864,9 +864,14 @@ public class WideAnglePanoramaModule
perct = mActivity.getResources().getInteger(R.integer.panorama_frame_size_reduction);
}
- mMosaicFrameProcessor.initialize(mCameraPreviewWidth * perct / 100,
- mCameraPreviewHeight * perct / 100, getPreviewBufSize());
- mMosaicFrameProcessorInitialized = true;
+ int width = (mCameraPreviewWidth * perct) / 100;
+ int height = (mCameraPreviewHeight * perct) / 100;
+ if ((0 < width) && (0 < height)) {
+ mMosaicFrameProcessor.initialize(width, height, getPreviewBufSize());
+ mMosaicFrameProcessorInitialized = true;
+ } else {
+ throw new RuntimeException("Invalid preview dimension");
+ }
}
@Override