changeset 8361:c34d5e164b22 libavcodec

AC3: fix strict aliasing violation in parser
author mru
date Wed, 17 Dec 2008 02:30:26 +0000
parents 850b735daef8
children 156137b60026
files ac3_parser.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ac3_parser.c	Wed Dec 17 02:30:22 2008 +0000
+++ b/ac3_parser.c	Wed Dec 17 02:30:26 2008 +0000
@@ -158,11 +158,14 @@
         int *need_next_header, int *new_frame_start)
 {
     int err;
-    uint64_t tmp = be2me_64(state);
+    union {
+        uint64_t u64;
+        uint8_t  u8[8];
+    } tmp = { be2me_64(state) };
     AC3HeaderInfo hdr;
     GetBitContext gbc;
 
-    init_get_bits(&gbc, ((uint8_t *)&tmp)+8-AC3_HEADER_SIZE, 54);
+    init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
     err = ff_ac3_parse_header(&gbc, &hdr);
 
     if(err < 0)