mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-10-13 01:35:40 +02:00
ggml : check row bounds in get_rows_back (llama/29575)
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
This commit is contained in:
@@ -5351,6 +5351,8 @@ static void ggml_compute_forward_get_rows_back_f32_f16(
|
||||
for (int i = 0; i < nr; ++i) {
|
||||
const int r = ((int32_t *) src1->data)[i];
|
||||
|
||||
GGML_ASSERT(r >= 0 && r < dst->ne[1]);
|
||||
|
||||
for (int j = 0; j < nc; ++j) {
|
||||
ggml_fp16_t v = ((ggml_fp16_t *) ((char *) src0->data + i*src0->nb[1]))[j];
|
||||
((float *) ((char *) dst->data + r*dst->nb[1]))[j] += GGML_CPU_FP16_TO_FP32(v);
|
||||
@@ -5384,6 +5386,8 @@ static void ggml_compute_forward_get_rows_back_f32(
|
||||
for (int i = 0; i < nr; ++i) {
|
||||
const int r = ((int32_t *) src1->data)[i];
|
||||
|
||||
GGML_ASSERT(r >= 0 && r < dst->ne[1]);
|
||||
|
||||
ggml_vec_add_f32(nc,
|
||||
(float *) ((char *) dst->data + r*dst->nb[1]),
|
||||
(float *) ((char *) dst->data + r*dst->nb[1]),
|
||||
|
||||
Reference in New Issue
Block a user