lavfi: vf_drawtext: check memory allocation

Switch to av_calloc and check the allocation.

Fix #22867
This commit is contained in:
Marvin Scholz
2026-04-21 23:40:07 +02:00
committed by Timo Rothenpieler
parent 117807510a
commit 69072fe8d8
+7 -2
View File
@@ -1435,8 +1435,13 @@ continue_on_failed:
}
s->line_count = line_count;
s->lines = av_mallocz(line_count * sizeof(TextLine));
s->tab_clusters = av_mallocz(s->tab_count * sizeof(uint32_t));
s->lines = av_calloc(line_count, sizeof(TextLine));
s->tab_clusters = av_calloc(s->tab_count, sizeof(uint32_t));
if ((line_count > 0 && !s->lines) ||
(s->tab_count > 0 && !s->tab_clusters)) {
ret = AVERROR(ENOMEM);
goto done;
}
for (i = 0; i < s->tab_count; ++i) {
s->tab_clusters[i] = -1;
}