History

lavfi/vf_zscale: fix tmp buffer ptr alignment for zimg_filter_graph_process

Pavel Koshevoy committed 2 years ago

Commit 7b302f41 parent f15fc271 file · +10 −3Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_zscale.c+10−3
@@ -628,9 +628,12 @@ static int graphs_build(AVFrame *in, AVFrame *out, const AVPixFmtDescriptor *des · 627 unmodified lines
628628 if (ret)
629629 return print_zimg_error(ctx);
630630
631+ if (size > (SIZE_MAX - ZIMG_ALIGNMENT))
632+ return AVERROR(ENOMEM);
633+
631634 if (s->tmp[job_nr])
632635 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);
634637 if (!s->tmp[job_nr])
635638 return AVERROR(ENOMEM);
636639
@@ -750,7 +753,9 @@ static int filter_slice(AVFilterContext *ctx, void *data, int job_nr, int n_jobs · 113 unmodified lines
750753 }
751754 if (!s->graph[job_nr])
752755 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);
754759 if (ret)
755760 return print_zimg_error(ctx);
756761
@@ -765,7 +770,9 @@ static int filter_slice(AVFilterContext *ctx, void *data, int job_nr, int n_jobs · 8 unmodified lines
765770
766771 if (!s->alpha_graph[job_nr])
767772 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);
769776 if (ret)
770777 return print_zimg_error(ctx);
771778 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t