[FFmpeg-devel] [PATCH] Fix segmentation fault when encoding CODEC_ID_PCM_F32BE frames

Michael Niedermayer michaelni
Sat Aug 9 18:39:40 CEST 2008


On Sat, Aug 09, 2008 at 12:40:47PM +0200, Stefano Sabatini wrote:
> Hi all,
> 
> this fixes segfaults in the PCM regression tests.
> 
> This seems due to the compiler (gcc 4.2) getting confused by this snippet:
> 
>     {
>         int32_t *samples = samples;
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^
>         for(;n>0;n--) {
>             register int32_t v = *samples++ + 0;
>             bytestream_put_be32(&dst, v);
>         }
>     }
> 
> I'm not sure this is the right fix though.
> 
> Regards.
> -- 
> FFmpeg = Foolish and Fast Mastering Proud Excellent Gangster

> Index: libavcodec/pcm.c
> ===================================================================
> --- libavcodec/pcm.c	(revision 14673)
> +++ libavcodec/pcm.c	(working copy)
> @@ -171,9 +171,9 @@
>   */
>  #define ENCODE(type, endian, src, dst, n, offset) \
>  { \
> -    type *samples = src; \
> +    type *samples2 = (type *)src; \

why the cast?
and samples2 is hardly the proper solution
ENCODE_s would be less likely to clash

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

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080809/2961aeab/attachment.pgp>



More information about the ffmpeg-devel mailing list