# HG changeset patch # User mru # Date 1246470502 0 # Node ID f3ff182e9ecf5f00462767de4b4f7f82d1fd6c63 # Parent efd0c5014ac745b7285bc2c1549e54961d13549f Fix potentially unaligned accesses in ff_copy_bits() A pointer should never be assigned a value which may have less than the required alignment of the target type. Compilers may assume pointer values have the required alignment, and emit normal load/store instructions. Unaligned pointers should use a character type or compiler-specific type modifiers. diff -r efd0c5014ac7 -r f3ff182e9ecf bitstream.c --- a/bitstream.c Wed Jul 01 17:29:52 2009 +0000 +++ b/bitstream.c Wed Jul 01 17:48:22 2009 +0000 @@ -78,7 +78,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) { - const uint16_t *srcw= (const uint16_t*)src; int words= length>>4; int bits= length&15; int i; @@ -86,7 +85,7 @@ if(length==0) return; if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){ - for(i=0; i>(16-bits)); + put_bits(pb, bits, AV_RB16(src + 2*words)>>(16-bits)); } /* VLC decoding */