Skip to content

Commit

Permalink
ggml : correct off-by-one bounds check in ggml_compute_forward_set_f32 (
Browse files Browse the repository at this point in the history
#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
  • Loading branch information
LoganDark authored Jun 7, 2023
1 parent 93a9af7 commit 76cf2d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 76cf2d6

Please sign in to comment.