mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2024-12-28 01:29:17 +01:00
gguf : fix potential infinite for-loop (llama/4600)
Co-authored-by: Bernhard Gstrein <gstrein@informatik.uni-freiburg.de>
This commit is contained in:
parent
396ebd1e80
commit
9aa9f3b84e
6
ggml.c
6
ggml.c
@ -19184,7 +19184,7 @@ void gguf_free(struct gguf_context * ctx) {
|
|||||||
|
|
||||||
if (ctx->kv) {
|
if (ctx->kv) {
|
||||||
// free string memory - not great..
|
// free string memory - not great..
|
||||||
for (uint32_t i = 0; i < ctx->header.n_kv; ++i) {
|
for (uint64_t i = 0; i < ctx->header.n_kv; ++i) {
|
||||||
struct gguf_kv * kv = &ctx->kv[i];
|
struct gguf_kv * kv = &ctx->kv[i];
|
||||||
|
|
||||||
if (kv->key.data) {
|
if (kv->key.data) {
|
||||||
@ -19200,7 +19200,7 @@ void gguf_free(struct gguf_context * ctx) {
|
|||||||
if (kv->type == GGUF_TYPE_ARRAY) {
|
if (kv->type == GGUF_TYPE_ARRAY) {
|
||||||
if (kv->value.arr.data) {
|
if (kv->value.arr.data) {
|
||||||
if (kv->value.arr.type == GGUF_TYPE_STRING) {
|
if (kv->value.arr.type == GGUF_TYPE_STRING) {
|
||||||
for (uint32_t j = 0; j < kv->value.arr.n; ++j) {
|
for (uint64_t j = 0; j < kv->value.arr.n; ++j) {
|
||||||
struct gguf_str * str = &((struct gguf_str *) kv->value.arr.data)[j];
|
struct gguf_str * str = &((struct gguf_str *) kv->value.arr.data)[j];
|
||||||
if (str->data) {
|
if (str->data) {
|
||||||
free(str->data);
|
free(str->data);
|
||||||
@ -19216,7 +19216,7 @@ void gguf_free(struct gguf_context * ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->infos) {
|
if (ctx->infos) {
|
||||||
for (uint32_t i = 0; i < ctx->header.n_tensors; ++i) {
|
for (uint64_t i = 0; i < ctx->header.n_tensors; ++i) {
|
||||||
struct gguf_tensor_info * info = &ctx->infos[i];
|
struct gguf_tensor_info * info = &ctx->infos[i];
|
||||||
|
|
||||||
if (info->name.data) {
|
if (info->name.data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user