summaryrefslogtreecommitdiff
path: root/core/image.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-05-31 21:22:18 +0200
committerGitHub <noreply@github.com>2019-05-31 21:22:18 +0200
commite9be875007bf109a8e2aab1fba1116f411979e14 (patch)
tree709878ba5032e5d634819821c1f2e1c05bcd88e6 /core/image.cpp
parenta69436aa4ea39d9bea5ad5df7d91ee87c1ed8380 (diff)
parent2b4e828b552164525fb40b2281167c2909dca822 (diff)
Merge pull request #29340 from qarmin/fix_array_overflow
Fix array overflow when saving scene preview
Diffstat (limited to 'core/image.cpp')
-rw-r--r--core/image.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/image.cpp b/core/image.cpp
index 30af724de9..c85d7f6bcc 100644
--- a/core/image.cpp
+++ b/core/image.cpp
@@ -749,7 +749,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
float scale_factor = MAX(x_scale, 1); // A larger kernel is required only when downscaling
int32_t half_kernel = LANCZOS_TYPE * scale_factor;
- float *kernel = memnew_arr(float, half_kernel * 2 - 1);
+ float *kernel = memnew_arr(float, half_kernel * 2);
for (int32_t buffer_x = 0; buffer_x < dst_width; buffer_x++) {
@@ -800,7 +800,7 @@ static void _scale_lanczos(const uint8_t *__restrict p_src, uint8_t *__restrict
float scale_factor = MAX(y_scale, 1);
int32_t half_kernel = LANCZOS_TYPE * scale_factor;
- float *kernel = memnew_arr(float, half_kernel * 2 - 1);
+ float *kernel = memnew_arr(float, half_kernel * 2);
for (int32_t dst_y = 0; dst_y < dst_height; dst_y++) {