diff options
author | Emilian Peev <epeevs@codeaurora.org> | 2014-12-15 14:42:20 +0200 |
---|---|---|
committer | Emilian Peev <epeevs@codeaurora.org> | 2015-03-05 18:17:22 +0200 |
commit | 02120bf815f1da3b1abac8d5e22127e414743b2c (patch) | |
tree | cfe3578aa2c130db52e973b297b94c470a04a70f /src/com/android | |
parent | 4f941e0245b1cb0c51449ada472c567fcb1cf960 (diff) | |
download | android_packages_apps_Snap-02120bf815f1da3b1abac8d5e22127e414743b2c.tar.gz android_packages_apps_Snap-02120bf815f1da3b1abac8d5e22127e414743b2c.tar.bz2 android_packages_apps_Snap-02120bf815f1da3b1abac8d5e22127e414743b2c.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: I5f66c2b2cc1a3d74898b5028933e578ea4097dfb
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index f7432bfb0..e7025a1a7 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -850,9 +850,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 |