Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-01-24 21:38:05 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-02-01 01:47:15 +0300
commited06873b7b2dcace1dd421d92c3aaee2a4d6b26d (patch)
treed67822eadf01045d8bf1fe2056f41f3c6262f8d5 /libavfilter/vf_transpose.c
parentc740f585a183abccd0ffc9cce67989b4bb0d08b9 (diff)
avfilter/vf_transpose: Fix used plane count.
Fixes out of array access Fixes: poc.mp4 Found-by: GwanYeong Kim <gy741.kim@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c6939f65a116b1ffed345d29d8621ee4ffb32235) (cherry picked from commit 3f621455d62e46745453568d915badd5b1e5bcd5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/vf_transpose.c')
-rw-r--r--libavfilter/vf_transpose.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index e4de31b042..0db0a3c5bd 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -27,6 +27,7 @@
#include <stdio.h>
+#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
@@ -54,6 +55,7 @@ enum TransposeDir {
typedef struct TransContext {
const AVClass *class;
int hsub, vsub;
+ int planes;
int pixsteps[4];
int passthrough; ///< PassthroughType, landscape passthrough mode enabled
@@ -105,6 +107,10 @@ static int config_props_output(AVFilterLink *outlink)
trans->hsub = desc_in->log2_chroma_w;
trans->vsub = desc_in->log2_chroma_h;
+ trans->planes = av_pix_fmt_count_planes(outlink->format);
+
+ av_assert0(desc_in->nb_components == desc_out->nb_components);
+
av_image_fill_max_pixsteps(trans->pixsteps, NULL, desc_out);
@@ -147,7 +153,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
AVFrame *in = td->in;
int plane;
- for (plane = 0; out->data[plane]; plane++) {
+ for (plane = 0; plane < trans->planes; plane++) {
int hsub = plane == 1 || plane == 2 ? trans->hsub : 0;
int vsub = plane == 1 || plane == 2 ? trans->vsub : 0;
int pixstep = trans->pixsteps[plane];