[FFmpeg-devel] [PATCH 1/2] AAC: fix strict aliasing violation in parser
Eli Friedman
eli.friedman
Sun Dec 14 23:08:45 CET 2008
On Sun, Dec 14, 2008 at 12:53 PM, Mans Rullgard <mans at mansr.com> wrote:
> - uint8_t tmp[8];
> + union {
> + uint64_t u64;
> + uint8_t u8[8];
> + } tmp;
>
> - AV_WB64(tmp, state);
> - init_get_bits(&bits, tmp+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
> + tmp.u64 = be2me_64(state);
> + init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
As far as I can tell, this patch does nothing except trick gcc...
uint8_t isn't technically guaranteed to be a character type, but in
practice, it always is, so uint8_t loads should always be safe. If
you're running into issues, the real cause is probably the code in
libavcodec/bitstream.h... it does some casting which looks wrong.
-Eli
More information about the ffmpeg-devel
mailing list