diff --git a/source/blender/imbuf/intern/scaling.cc b/source/blender/imbuf/intern/scaling.cc index 12f01254966..09149e2a3ea 100644 --- a/source/blender/imbuf/intern/scaling.cc +++ b/source/blender/imbuf/intern/scaling.cc @@ -343,7 +343,7 @@ static void alloc_scale_dst_buffers( { *r_dst_byte = nullptr; if (ibuf->byte_buffer.data != nullptr) { - *r_dst_byte = MEM_malloc_arrayN(newx * newy, "scale_buf_byte"); + *r_dst_byte = MEM_malloc_arrayN(size_t(newx) * size_t(newy), "scale_buf_byte"); if (*r_dst_byte == nullptr) { return; } @@ -413,8 +413,8 @@ struct ScaleDownX { const int grain_size = threaded ? 32 : ibufy; threading::parallel_for(IndexRange(ibufy), grain_size, [&](IndexRange range) { for (const int y : range) { - const T *src_ptr = src + y * ibufx; - T *dst_ptr = dst + y * newx; + const T *src_ptr = src + (int64_t(y) * ibufx); + T *dst_ptr = dst + (int64_t(y) * newx); float sample = 0.0f; float4 val(0.0f); @@ -502,8 +502,8 @@ struct ScaleUpX { for (const int y : range) { float sample = -0.5f + add * 0.5f; int counter = 0; - const T *src_ptr = src + y * ibufx; - T *dst_ptr = dst + y * newx; + const T *src_ptr = src + (int64_t(y) * ibufx); + T *dst_ptr = dst + (int64_t(y) * newx); float4 val = load_pixel(src_ptr); float4 nval = load_pixel(src_ptr + 1); float4 diff = nval - val;