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
628 if (ret)628 if (ret)
629 return print_zimg_error(ctx);629 return print_zimg_error(ctx);
630 630
631 if (size > (SIZE_MAX - ZIMG_ALIGNMENT))
632 return AVERROR(ENOMEM);
633
631 if (s->tmp[job_nr])634 if (s->tmp[job_nr])
632 av_freep(&s->tmp[job_nr]);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 if (!s->tmp[job_nr])637 if (!s->tmp[job_nr])
635 return AVERROR(ENOMEM);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 if (!s->graph[job_nr])754 if (!s->graph[job_nr])
752 return AVERROR(EINVAL);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 if (ret)759 if (ret)
755 return print_zimg_error(ctx);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 if (!s->alpha_graph[job_nr])771 if (!s->alpha_graph[job_nr])
767 return AVERROR(EINVAL);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 if (ret)776 if (ret)
770 return print_zimg_error(ctx);777 return print_zimg_error(ctx);
771 }778 }

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