[FFmpeg-devel] [PATCH 2/8] libutvideodec: Replace a silly stay constant

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Nov 7 19:20:07 CET 2011


On Mon, Nov 07, 2011 at 07:12:26PM +0100, Reimar Döffinger wrote:
> On Mon, Nov 07, 2011 at 12:20:23PM -0500, Derek Buitenhuis wrote:
> > Replace a silly '4*4' with a proper sizeof() call,
> > for setting the extradata size.
> > 
> > Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> > ---
> >  libavcodec/libutvideo.cpp |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/libavcodec/libutvideo.cpp b/libavcodec/libutvideo.cpp
> > index fa1bcc5..43b5209 100644
> > --- a/libavcodec/libutvideo.cpp
> > +++ b/libavcodec/libutvideo.cpp
> > @@ -53,7 +53,7 @@ static av_cold int utvideo_decode_init(AVCodecContext *avctx)
> >      UtVideoExtra info;
> >      int format;
> >  
> > -    if(avctx->extradata_size != 4*4)
> > +    if(avctx->extradata_size != sizeof(UtVideoExtra))
> 
> That is no good, there is no guarantee how exactly the compiler
> lays it out and thus sizeof(UtVideoExtra) could also be e.g.
> 32 (on an hypothetical architecture that can only read 8 byte
> aligned ints).

I see that DecodeBegin already uses it, something seems wrong here.


More information about the ffmpeg-devel mailing list