[Ffmpeg-devel] [PATCH] fix non char arrays feed to string functions

Panagiotis Issaris takis.issaris
Thu Jan 25 13:12:28 CET 2007


Hi M?ns,

On Thu, 2007-01-25 at 09:36 +0000, M?ns Rullg?rd wrote:
> Luca Barbato <lu_zero at gentoo.org> writes:
> 
> > makes few warnings disappear.
> >
> > (again from the another diego (yes I'm slow))
> >
> > Index: libavcodec/bitstream_filter.c
> > ===================================================================
> > --- libavcodec/bitstream_filter.c	(revision 7568)
> > +++ libavcodec/bitstream_filter.c	(working copy)
> > @@ -21,6 +21,9 @@
> >  #include "avcodec.h"
> >  #include "mpegaudio.h"
> >  
> > +static const char ffcmp3_signature[11] =
> > +  { 'F', 'F', 'C', 'M', 'P', '3', ' ', '0', '.', '0', '\0' };
> > +
> >  AVBitStreamFilter *first_bitstream_filter= NULL;
> >  
> >  void av_register_bitstream_filter(AVBitStreamFilter *bsf){
> > @@ -153,7 +156,7 @@
> >      if(avctx->extradata_size == 0){
> >          avctx->extradata_size=15;
> >          avctx->extradata= av_malloc(avctx->extradata_size);
> > -        strcpy(avctx->extradata, "FFCMP3 0.0");
> > +        memcpy(avctx->extradata, ffcmp3_signature, sizeof(ffcmp3_signature));
> >          memcpy(avctx->extradata+11, buf, 4);
> >      }
> >      if(avctx->extradata_size != 15){
> 
> WTF is this supposed to fix?  Rejected.  All of it.
I think the patch was send because GCC complained that
extradata is unsigned while "FFCMP3 0.0" is signed.

Would you prefer something like this?
-        strcpy(avctx->extradata, "FFCMP3 0.0");
+        strcpy((char*)avctx->extradata, "FFCMP3 0.0");

With friendly regards,
Takis

-- 
vCard: http://www.issaris.org/pi.vcf
Public key: http://www.issaris.org/pi.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070125/90fcc08a/attachment.pgp>



More information about the ffmpeg-devel mailing list