Browse Source

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 c6939f65a1)
(cherry picked from commit 3f621455d6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.4.2
Michael Niedermayer 7 years ago
parent
commit
2980b95faf
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      libavfilter/vf_transpose.c

+ 7
- 1
libavfilter/vf_transpose.c View File

@@ -27,6 +27,7 @@


#include <stdio.h> #include <stdio.h>


#include "libavutil/avassert.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
@@ -54,6 +55,7 @@ enum TransposeDir {
typedef struct TransContext { typedef struct TransContext {
const AVClass *class; const AVClass *class;
int hsub, vsub; int hsub, vsub;
int planes;
int pixsteps[4]; int pixsteps[4];


int passthrough; ///< PassthroughType, landscape passthrough mode enabled int passthrough; ///< PassthroughType, landscape passthrough mode enabled
@@ -215,6 +217,10 @@ static int config_props_output(AVFilterLink *outlink)


s->hsub = desc_in->log2_chroma_w; s->hsub = desc_in->log2_chroma_w;
s->vsub = desc_in->log2_chroma_h; s->vsub = desc_in->log2_chroma_h;
s->planes = av_pix_fmt_count_planes(outlink->format);

av_assert0(desc_in->nb_components == desc_out->nb_components);



av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out); av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out);


@@ -272,7 +278,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
AVFrame *in = td->in; AVFrame *in = td->in;
int plane; int plane;


for (plane = 0; out->data[plane]; plane++) {
for (plane = 0; plane < s->planes; plane++) {
int hsub = plane == 1 || plane == 2 ? s->hsub : 0; int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
int vsub = plane == 1 || plane == 2 ? s->vsub : 0; int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
int pixstep = s->pixsteps[plane]; int pixstep = s->pixsteps[plane];


Loading…
Cancel
Save