From c82cd24ac7fdc80f40910b189add5d700199d2e2 Mon Sep 17 00:00:00 2001 From: Sam Hasinoff Date: Wed, 11 Apr 2018 11:19:41 -0700 Subject: [PATCH] Fix bad pixel out-of-bounds filter Bug: 78243840 Test: build Change-Id: I48c5e4bf7081c9d0dc79128e644f4f9f9debb84e --- core/jni/android_hardware_camera2_DngCreator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/jni/android_hardware_camera2_DngCreator.cpp b/core/jni/android_hardware_camera2_DngCreator.cpp index 162822092af6f..567bb075d746c 100644 --- a/core/jni/android_hardware_camera2_DngCreator.cpp +++ b/core/jni/android_hardware_camera2_DngCreator.cpp @@ -1723,13 +1723,13 @@ static sp DngCreator_setup(JNIEnv* env, jobject thiz, uint32_t image // Adjust the bad pixel coordinates to be relative to the origin of the active area DNG tag std::vector v; - for (size_t i = 0; i < entry3.count; i+=2) { + for (size_t i = 0; i < entry3.count; i += 2) { int32_t x = entry3.data.i32[i]; int32_t y = entry3.data.i32[i + 1]; x -= static_cast(xmin); y -= static_cast(ymin); if (x < 0 || y < 0 || static_cast(x) >= width || - static_cast(y) >= width) { + static_cast(y) >= height) { continue; } v.push_back(x);