Unified · Split
| @@ -628,9 +628,12 @@ static int graphs_build(AVFrame *in, AVFrame *out, const AVPixFmtDescriptor *des · 627 unmodified lines | ||
| 628 | 628 | if (ret) |
| 629 | 629 | return print_zimg_error(ctx); |
| 630 | 630 | |
| 631 | + if (size > (SIZE_MAX - ZIMG_ALIGNMENT)) | |
| 632 | + return AVERROR(ENOMEM); | |
| 633 | + | |
| 631 | 634 | if (s->tmp[job_nr]) |
| 632 | 635 | av_freep(&s->tmp[job_nr]); |
| 633 | − s->tmp[job_nr] = av_calloc(size, 1); | |
| 636 | + s->tmp[job_nr] = av_mallocz(size + ZIMG_ALIGNMENT); | |
| 634 | 637 | if (!s->tmp[job_nr]) |
| 635 | 638 | return AVERROR(ENOMEM); |
| 636 | 639 | |
| @@ -750,7 +753,9 @@ static int filter_slice(AVFilterContext *ctx, void *data, int job_nr, int n_jobs · 113 unmodified lines | ||
| 750 | 753 | } |
| 751 | 754 | if (!s->graph[job_nr]) |
| 752 | 755 | return AVERROR(EINVAL); |
| 753 | − ret = zimg_filter_graph_process(s->graph[job_nr], &src_buf, &dst_buf, s->tmp[job_nr], 0, 0, 0, 0); | |
| 756 | + ret = zimg_filter_graph_process(s->graph[job_nr], &src_buf, &dst_buf, | |
| 757 | + (uint8_t *)FFALIGN((uintptr_t)s->tmp[job_nr], ZIMG_ALIGNMENT), | |
| 758 | + 0, 0, 0, 0); | |
| 754 | 759 | if (ret) |
| 755 | 760 | return print_zimg_error(ctx); |
| 756 | 761 | |
| @@ -765,7 +770,9 @@ static int filter_slice(AVFilterContext *ctx, void *data, int job_nr, int n_jobs · 8 unmodified lines | ||
| 765 | 770 | |
| 766 | 771 | if (!s->alpha_graph[job_nr]) |
| 767 | 772 | return AVERROR(EINVAL); |
| 768 | − ret = zimg_filter_graph_process(s->alpha_graph[job_nr], &src_buf, &dst_buf, s->tmp[job_nr], 0, 0, 0, 0); | |
| 773 | + ret = zimg_filter_graph_process(s->alpha_graph[job_nr], &src_buf, &dst_buf, | |
| 774 | + (uint8_t *)FFALIGN((uintptr_t)s->tmp[job_nr], ZIMG_ALIGNMENT), | |
| 775 | + 0, 0, 0, 0); | |
| 769 | 776 | if (ret) |
| 770 | 777 | return print_zimg_error(ctx); |
| 771 | 778 | } |