[FFmpeg-devel,v1] avfilter/asrc_anoisesrc: change type to TYPE_INT64 for color is int64_t

Submitted by lance.lmwang@gmail.com on Oct. 26, 2019, 2:09 a.m.

Details

Message ID 20191026020904.5775-1-lance.lmwang@gmail.com
State New
Headers show

Commit Message

lance.lmwang@gmail.com Oct. 26, 2019, 2:09 a.m.
From: Limin Wang <lance.lmwang@gmail.com>

Or it'll cause invalid color and s->filter is NULL.
Please reproduce it with below command on big endian system:
$ ./ffmpeg -f lavfi -i "anoisesrc=d=60:c=1:r=48000" -f s16le -c:a pcm_s16le  -f null  -
Segmentation fault (core dumped)

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/asrc_anoisesrc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Paul B Mahol Oct. 26, 2019, 7:33 a.m.
Not OK, variable should be int and not int64_t.

On 10/26/19, lance.lmwang@gmail.com <lance.lmwang@gmail.com> wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
>
> Or it'll cause invalid color and s->filter is NULL.
> Please reproduce it with below command on big endian system:
> $ ./ffmpeg -f lavfi -i "anoisesrc=d=60:c=1:r=48000" -f s16le -c:a pcm_s16le
> -f null  -
> Segmentation fault (core dumped)
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/asrc_anoisesrc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
> index 78f0af4fde..8a6ef89dd1 100644
> --- a/libavfilter/asrc_anoisesrc.c
> +++ b/libavfilter/asrc_anoisesrc.c
> @@ -60,9 +60,9 @@ static const AVOption anoisesrc_options[] = {
>      { "a",            "set amplitude",    OFFSET(amplitude),
> AV_OPT_TYPE_DOUBLE,    {.dbl = 1.},        0.,  1.,         FLAGS },
>      { "duration",     "set duration",     OFFSET(duration),
> AV_OPT_TYPE_DURATION,  {.i64 =  0},         0,  INT64_MAX,  FLAGS },
>      { "d",            "set duration",     OFFSET(duration),
> AV_OPT_TYPE_DURATION,  {.i64 =  0},         0,  INT64_MAX,  FLAGS },
> -    { "color",        "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
> -    { "colour",       "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
> -    { "c",            "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
> +    { "color",        "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
> +    { "colour",       "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
> +    { "c",            "set noise color",  OFFSET(color),
> AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color"
> },
>      {     "white",    0,                  0,
> AV_OPT_TYPE_CONST,     {.i64 = NM_WHITE},   0,  0,          FLAGS, "color"
> },
>      {     "pink",     0,                  0,
> AV_OPT_TYPE_CONST,     {.i64 = NM_PINK},    0,  0,          FLAGS, "color"
> },
>      {     "brown",    0,                  0,
> AV_OPT_TYPE_CONST,     {.i64 = NM_BROWN},   0,  0,          FLAGS, "color"
> },
> --
> 2.21.0
>
> _______________________________________________
> 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".

Patch hide | download patch | download mbox

diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c
index 78f0af4fde..8a6ef89dd1 100644
--- a/libavfilter/asrc_anoisesrc.c
+++ b/libavfilter/asrc_anoisesrc.c
@@ -60,9 +60,9 @@  static const AVOption anoisesrc_options[] = {
     { "a",            "set amplitude",    OFFSET(amplitude),    AV_OPT_TYPE_DOUBLE,    {.dbl = 1.},        0.,  1.,         FLAGS },
     { "duration",     "set duration",     OFFSET(duration),     AV_OPT_TYPE_DURATION,  {.i64 =  0},         0,  INT64_MAX,  FLAGS },
     { "d",            "set duration",     OFFSET(duration),     AV_OPT_TYPE_DURATION,  {.i64 =  0},         0,  INT64_MAX,  FLAGS },
-    { "color",        "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
-    { "colour",       "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
-    { "c",            "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT,       {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
+    { "color",        "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
+    { "colour",       "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
+    { "c",            "set noise color",  OFFSET(color),        AV_OPT_TYPE_INT64,     {.i64 =  0},         0,  NM_NB - 1,  FLAGS, "color" },
     {     "white",    0,                  0,                    AV_OPT_TYPE_CONST,     {.i64 = NM_WHITE},   0,  0,          FLAGS, "color" },
     {     "pink",     0,                  0,                    AV_OPT_TYPE_CONST,     {.i64 = NM_PINK},    0,  0,          FLAGS, "color" },
     {     "brown",    0,                  0,                    AV_OPT_TYPE_CONST,     {.i64 = NM_BROWN},   0,  0,          FLAGS, "color" },