[FFmpeg-devel] [PATCH] avcodec/pngdec: initialize "foreground_alpha"

Michael Niedermayer michaelni at gmx.at
Mon Oct 5 04:16:58 CEST 2015


On Sun, Oct 04, 2015 at 09:21:55PM -0400, Ganesh Ajjanagadde wrote:
> Fixes CID 1322359, CID 1322358.
> 
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavcodec/pngdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
> index d180141..fe22225 100644
> --- a/libavcodec/pngdec.c
> +++ b/libavcodec/pngdec.c
> @@ -1006,7 +1006,7 @@ static int handle_p_frame_apng(AVCodecContext *avctx, PNGDecContext *s,
>              uint8_t *background = buffer + s->image_linesize * y + s->bpp * s->x_offset;
>              for (x = s->x_offset; x < s->x_offset + s->cur_w; ++x, foreground += s->bpp, background += s->bpp) {
>                  size_t b;
> -                uint8_t foreground_alpha, background_alpha, output_alpha;
> +                uint8_t foreground_alpha = 0, background_alpha, output_alpha;

this looks very odd
have you checked that the reference png implementation and png spec
set foreground_alpha to 0 for cases that FFmpeg doesnt implement ? ;)

warnings can point to bugs and if so the bug should be fixed which
should make the warning disappear. If a warning doesnt point to a bug
then it should be silenced in some clean way

It seems you try to silence this one without really realizing
what is wrong with the codepath in which this warning occurs

I didnt write it but to me it seems the if() a few lines above is
intended to stop this codepath
see 'avpriv_request_sample(avctx, "Blending with pixel format %s",'

it doesnt work as blend_op is assumed to have only 2 values but
this is not checked for anywhere.
blend_op should be checked when/before it is set


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151005/955e8ad8/attachment.sig>


More information about the ffmpeg-devel mailing list