From 49f9f35a7f7623a3aecdaf9beda31e9a7243f69a Mon Sep 17 00:00:00 2001 From: wejoncy Date: Wed, 8 Feb 2023 19:42:11 +0800 Subject: [PATCH] [prefast:Warning]: C26451 --- onnxruntime/core/providers/cpu/tensor/upsample_antialias.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h b/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h index e5e641e96f7af..59b512def619d 100644 --- a/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h +++ b/onnxruntime/core/providers/cpu/tensor/upsample_antialias.h @@ -414,7 +414,8 @@ void ComputeInterpolationAtLevel2(int64_t num_channels, int64_t input_height, in static_cast(output_height * 2), [&](std::ptrdiff_t first, std::ptrdiff_t last) { if (output_height == input_height) { - std::copy_n(Xdata_span.begin() + narrow(first * input_width), narrow((last - first) * output_width), + auto workload_in_thread = narrow(last) - narrow(first); + std::copy_n(Xdata_span.begin() + narrow(first * input_width), narrow(workload_in_thread * output_width), Ydata_span.begin() + narrow(first * output_width)); return; }