Skip to content

Commit d1938ad

Browse files
committed
Improved GGML_ASSERT on wdata boundaries
1 parent b56d0ac commit d1938ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ggml/src/ggml-cpu/repack.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,11 +1630,12 @@ template <typename BLOC_TYPE, int64_t INTER_SIZE, int64_t NB_COLS, ggml_type PAR
16301630
const char * src0_ptr = (const char *) src0->data + i02 * nb02;
16311631
const char * src1_ptr = (const char *) params->wdata + (i11 + i12 * ne11) * src1_col_stride;
16321632
char * dst_ptr = ((char *) dst->data + (i1 * nb1 + i2 * nb2));
1633-
GGML_ASSERT(src1_ptr >= params->wdata && src1_ptr < ((const char *)params->wdata + params->wsize));
16341633

16351634
const int64_t nrows = src1_end - src1_start;
16361635
const int64_t ncols = src0_end - src0_start;
16371636

1637+
GGML_ASSERT(src1_ptr + src1_col_stride * nrows <= (const char *) params->wdata + params->wsize);
1638+
16381639
// If there are more than three rows in src1, use gemm; otherwise, use gemv.
16391640
if (nrows > 3) {
16401641
gemm<BLOC_TYPE, INTER_SIZE, NB_COLS, PARAM_TYPE>(ne00, (float *) (dst_ptr) + src0_start, nb1 / nb0,

0 commit comments

Comments
 (0)