Skip to content

Commit df5478f

Browse files
ggml: fix div-by-zero (ggml-org#9003)
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70724 In order to access the above bug you need to login using one of the emails in https://github.com/google/oss-fuzz/blob/master/projects/llamacpp/project.yaml#L3-L5 Signed-off-by: David Korczynski <[email protected]>
1 parent 2589292 commit df5478f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ggml/src/ggml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21129,7 +21129,7 @@ struct gguf_context * gguf_init_from_file(const char * fname, struct gguf_init_p
2112921129
(int64_t) info->ne[2] *
2113021130
(int64_t) info->ne[3];
2113121131

21132-
if (ne % ggml_blck_size(info->type) != 0) {
21132+
if (ggml_blck_size(info->type) == 0 || ne % ggml_blck_size(info->type) != 0) {
2113321133
fprintf(stderr, "%s: tensor '%s' of type %d (%s) number of elements (%" PRId64 ") is not a multiple of block size (%" PRId64 ")\n",
2113421134
__func__, info->name.data, (int) info->type, ggml_type_name(info->type), ne, ggml_blck_size(info->type));
2113521135
fclose(file);

0 commit comments

Comments
 (0)