[FFmpeg-devel] [PATCH 0/2] Fix strict aliasing violations in AAC and AC3 parsers

Uoti Urpala uoti.urpala
Sun Dec 14 23:26:33 CET 2008


On Sun, 2008-12-14 at 20:53 +0000, Mans Rullgard wrote:
> The AAC and AC3 parsers both violate strict aliasing rules when using
> a uint64_t variable as buffer for the bitstream reader.  Although I am
> not entirely certain of the strict validity of these patches, they are
> sufficient to make gcc do the right thing, and they can't make things
> any worse.

> Please comment.

They are not strictly valid. If you want to use an union then the union
would need to contain all the types used to access the data and the
accesses would need to use uniontype.fieldname syntax. Your union lacks
the type bitstream uses to access the data and bitstream accesses do not
use uniontype.fieldname syntax.

I already posted a better way to fix it when this was discussed earlier
on ffmpeg-cvslog. Attached is a working implementation (though of course
the #defines are not meant to be committed as is, you should change the
code accordingly instead).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aac.diff
Type: text/x-patch
Size: 1071 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081215/2bd37148/attachment.bin>



More information about the ffmpeg-devel mailing list