Skip to content

Commit 48f94d4

Browse files
committed
ggml : check ne00 <= INT32_MAX in argmax and argsort
1 parent 316f3d3 commit 48f94d4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ggml/src/ggml.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,7 @@ struct ggml_tensor * ggml_argmax(
22552255
struct ggml_context * ctx,
22562256
struct ggml_tensor * a) {
22572257
GGML_ASSERT(ggml_is_matrix(a));
2258+
GGML_ASSERT(a->ne[0] <= INT32_MAX);
22582259

22592260
struct ggml_tensor * result = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, a->ne[1]);
22602261

@@ -4138,6 +4139,7 @@ struct ggml_tensor * ggml_argsort(
41384139
struct ggml_context * ctx,
41394140
struct ggml_tensor * a,
41404141
enum ggml_sort_order order) {
4142+
GGML_ASSERT(a->ne[0] <= INT32_MAX);
41414143
struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_I32, GGML_MAX_DIMS, a->ne);
41424144

41434145
ggml_set_op_params_i32(result, 0, (int32_t) order);

0 commit comments

Comments
 (0)