[FFmpeg-devel] [PATCH] sbgdec: dont set slide to a uninitialized value

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 6 21:30:09 CET 2012


On Tue, Nov 06, 2012 at 09:22:25PM +0100, Michael Niedermayer wrote:
> Fixed CID703833
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/sbgdec.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
> index 93c8cb3..11a47cf 100644
> --- a/libavformat/sbgdec.c
> +++ b/libavformat/sbgdec.c
> @@ -506,7 +506,8 @@ static int parse_fade(struct sbg_parser *p, struct sbg_fade *fr)
>          f.out = SBG_FADE_ADAPT;
>      else
>          return AVERROR_INVALIDDATA;
> -    *fr = f;
> +    fr->in  = f.in;
> +    fr->out = f.out;

Personally I would slightly prefer it if either f was initialized
or the function would just use
int8_t in, out;
instead of the struct.
A half-initialized struct seems like something very easy to use
incorrectly with future changes.


More information about the ffmpeg-devel mailing list