From: LoganDark Date: Wed, 7 Jun 2023 16:16:19 +0000 (-0700) Subject: ggml : correct off-by-one bounds check in ggml_compute_forward_set_f32 (#229) X-Git-Tag: upstream/0.0.1642~1414 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=76cf2d647beedd26e6cf519bafec51e215b808a8;p=pkg%2Fggml%2Fsources%2Fggml ggml : correct off-by-one bounds check in ggml_compute_forward_set_f32 (#229) without this fix you will be unable to set a zero-length tensor to the end of another tensor this sounds stupid, but is used in my testing --- diff --git a/src/ggml.c b/src/ggml.c index f4150161..c485733f 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -10359,7 +10359,7 @@ static void ggml_compute_forward_set_f32( const int im2 = (ne12 == 0 ? 0 : ne12-1); const int im3 = (ne13 == 0 ? 0 : ne13-1); - GGML_ASSERT(offset + im0*nb0 + im1*nb1 + im2*nb2 + im3*nb3 < ggml_nbytes(dst)); + GGML_ASSERT(offset + im0*nb0 + im1*nb1 + im2*nb2 + im3*nb3 <= ggml_nbytes(dst)); GGML_ASSERT(nb10 == sizeof(float));