diff mbox series

[FFmpeg-devel] avfilter/vf_v360: check the limit of in_pad and out_pad

Message ID 20200421133512.96122-1-lq@chinaffmpeg.org
State New
Headers show
Series [FFmpeg-devel] avfilter/vf_v360: check the limit of in_pad and out_pad | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Liu Steven April 21, 2020, 1:35 p.m. UTC
When i set out_pad=1 it will Segmentation fault
so i think it should check the limit value of the in_pad and out_pad

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavfilter/vf_v360.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Nicolas George April 21, 2020, 1:38 p.m. UTC | #1
Steven Liu (12020-04-21):
> When i set out_pad=1 it will Segmentation fault
> so i think it should check the limit value of the in_pad and out_pad
> 
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavfilter/vf_v360.c | 4 ++++
>  1 file changed, 4 insertions(+)

Please don't guess. Find the exact cause of the crash. The value 1 is
allowed by the option system, it is therefore a priori supposed to work,
rejecting it somewhere else is not a proper fix.

> +        av_log(s, AV_LOG_ERROR, "pad should smaller than 1.0\n");

Also a missing verb.

Regards,
Paul B Mahol April 21, 2020, 2:28 p.m. UTC | #2
On 4/21/20, Steven Liu <lq@chinaffmpeg.org> wrote:
> When i set out_pad=1 it will Segmentation fault
> so i think it should check the limit value of the in_pad and out_pad

So huge pads do not make sense.
Limit it to 1/10 in via options.
Liu Steven April 21, 2020, 2:32 p.m. UTC | #3
> 2020年4月21日 下午10:28,Paul B Mahol <onemda@gmail.com> 写道:
> 
> On 4/21/20, Steven Liu <lq@chinaffmpeg.org> wrote:
>> When i set out_pad=1 it will Segmentation fault
>> so i think it should check the limit value of the in_pad and out_pad
> 
> So huge pads do not make sense.
Yes, just don’t know how to use it, and try to set it to 1, so get the exception. :D
> Limit it to 1/10 in via options.
What about modify the limit  looks like this ?
{   "out_pad", "percent output cubemap pads",  OFFSET(out_pad), AV_OPT_TYPE_FLOAT,  {.dbl=0.f},           0.f,                 0.1,TFLAGS, "out_pad"},
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Thanks

Steven Liu
Paul B Mahol April 21, 2020, 2:38 p.m. UTC | #4
On 4/21/20, Steven Liu <lq@chinaffmpeg.org> wrote:
>
>
>> 2020年4月21日 下午10:28,Paul B Mahol <onemda@gmail.com> 写道:
>>
>> On 4/21/20, Steven Liu <lq@chinaffmpeg.org> wrote:
>>> When i set out_pad=1 it will Segmentation fault
>>> so i think it should check the limit value of the in_pad and out_pad
>>
>> So huge pads do not make sense.
> Yes, just don’t know how to use it, and try to set it to 1, so get the
> exception. :D
>> Limit it to 1/10 in via options.
> What about modify the limit  looks like this ?
> {   "out_pad", "percent output cubemap pads",  OFFSET(out_pad),
> AV_OPT_TYPE_FLOAT,  {.dbl=0.f},           0.f,                 0.1,TFLAGS,

Yes, like that.

> "out_pad"},
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
> Thanks
>
> Steven Liu
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index ebc281dfca..6aabbc11ff 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3766,6 +3766,10 @@  static int config_output(AVFilterLink *outlink)
     int (*prepare_out)(AVFilterContext *ctx);
     int have_alpha;
 
+    if (s->out_pad == 1.0 || s->in_pad == 1.0) {
+        av_log(s, AV_LOG_ERROR, "pad should smaller than 1.0\n");
+        return AVERROR(EINVAL);
+    }
     s->max_value = (1 << depth) - 1;
     s->input_mirror_modifier[0] = s->ih_flip ? -1.f : 1.f;
     s->input_mirror_modifier[1] = s->iv_flip ? -1.f : 1.f;