[FFmpeg-cvslog] r19160 - trunk/libavutil/crc.c
heydowns
subversion
Fri Jun 12 04:13:12 CEST 2009
Author: heydowns
Date: Fri Jun 12 04:13:12 2009
New Revision: 19160
Log:
Fix cast of byte buffer to uint32 that was disregarding alignment
requirements.
Now calculates crc byte at a time until aligned, then continues with uint32
optimized calculation.
This fixes crashes during mlp decoding on sparc (at least, maybe others).
Modified:
trunk/libavutil/crc.c
Modified: trunk/libavutil/crc.c
==============================================================================
--- trunk/libavutil/crc.c Fri Jun 12 03:09:49 2009 (r19159)
+++ trunk/libavutil/crc.c Fri Jun 12 04:13:12 2009 (r19160)
@@ -115,7 +115,10 @@ uint32_t av_crc(const AVCRC *ctx, uint32
const uint8_t *end= buffer+length;
#if !CONFIG_SMALL
- if(!ctx[256])
+ if(!ctx[256]) {
+ while(((intptr_t) buffer & 3) && buffer < end)
+ crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
+
while(buffer<end-3){
crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;
crc = ctx[3*256 + ( crc &0xFF)]
@@ -123,6 +126,7 @@ uint32_t av_crc(const AVCRC *ctx, uint32
^ctx[1*256 + ((crc>>16)&0xFF)]
^ctx[0*256 + ((crc>>24) )];
}
+ }
#endif
while(buffer<end)
crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
More information about the ffmpeg-cvslog
mailing list