From: Georgi Gerganov Date: Fri, 3 Oct 2025 16:18:56 +0000 (+0300) Subject: metal : fix loop bound in ggml_mem_ranges (llama/16412) X-Git-Tag: upstream/0.9.4.58~45 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=75017c20dc85b55ce1c2b04cf49b456f7aaad3a8;p=pkg%2Fggml%2Fsources%2Fggml metal : fix loop bound in ggml_mem_ranges (llama/16412) --- diff --git a/src/ggml-metal/ggml-metal-common.cpp b/src/ggml-metal/ggml-metal-common.cpp index dc7d241c..95627d38 100644 --- a/src/ggml-metal/ggml-metal-common.cpp +++ b/src/ggml-metal/ggml-metal-common.cpp @@ -112,7 +112,7 @@ static bool ggml_mem_ranges_add_dst(ggml_mem_ranges_t mrs, const ggml_tensor * t } bool ggml_mem_ranges_add(ggml_mem_ranges_t mrs, const ggml_tensor * tensor) { - for (int i = 0; i < GGML_MAX_DIMS; i++) { + for (int i = 0; i < GGML_MAX_SRC; i++) { if (tensor->src[i]) { ggml_mem_ranges_add_src(mrs, tensor->src[i]); } @@ -173,7 +173,7 @@ static bool ggml_mem_ranges_check_dst(ggml_mem_ranges_t mrs, const ggml_tensor * } bool ggml_mem_ranges_check(ggml_mem_ranges_t mrs, const ggml_tensor * tensor) { - for (int i = 0; i < GGML_MAX_DIMS; i++) { + for (int i = 0; i < GGML_MAX_SRC; i++) { if (tensor->src[i]) { if (!ggml_mem_ranges_check_src(mrs, tensor->src[i])) { return false;