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

Måns Rullgård mru
Thu Jan 25 13:24:23 CET 2007


Panagiotis Issaris said:
> 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");

No.  I will add the -Wno-pointer-sign flag tonight instead.  "Fixing" those
warnings is at best pointless, and in some cases impossible.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list