summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-23 10:17:46 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-23 10:20:57 +0200
commit8732eb124e565c5bd8574351375ccbff28e261c6 (patch)
tree1335cc67c2db4447860bf419a7412f10f379d50c
parent1cdc805228c777e5e525cf5bc252c768875b5b19 (diff)
downloadffmpeg-streaming-8732eb124e565c5bd8574351375ccbff28e261c6.zip
ffmpeg-streaming-8732eb124e565c5bd8574351375ccbff28e261c6.tar.gz
avfilter/vf_floodfill: better fix for crash
-rw-r--r--libavfilter/vf_floodfill.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/libavfilter/vf_floodfill.c b/libavfilter/vf_floodfill.c
index d40043c..11c614a 100644
--- a/libavfilter/vf_floodfill.c
+++ b/libavfilter/vf_floodfill.c
@@ -35,6 +35,7 @@ typedef struct FloodfillContext {
int x, y;
int s[4];
+ int S[4];
int d[4];
int nb_planes;
@@ -293,26 +294,30 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
const int h = frame->height;
int i, ret;
- for (i = 0; i < s->nb_planes; i++) {
- if (s->s[i] != s->d[i])
- break;
- }
-
- if (i == s->nb_planes)
- goto end;
-
- if (ret = av_frame_make_writable(frame))
- return ret;
-
if (is_inside(s->x, s->y, w, h)) {
s->pick_pixel(frame, s->x, s->y, &s0, &s1, &s2, &s3);
+ s->S[0] = s0;
+ s->S[1] = s1;
+ s->S[2] = s2;
+ s->S[3] = s3;
+ for (i = 0; i < s->nb_planes; i++) {
+ if (s->S[i] != s->d[i])
+ break;
+ }
+
+ if (i == s->nb_planes)
+ goto end;
+
if (s->is_same(frame, s->x, s->y, s0, s1, s2, s3)) {
s->points[s->front].x = s->x;
s->points[s->front].y = s->y;
s->front++;
}
+ if (ret = av_frame_make_writable(frame))
+ return ret;
+
while (s->front > s->back) {
int x, y;
OpenPOWER on IntegriCloud