From 7cc8d616aab68ba5534e5a74214786ad08aac5ce Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Mon, 15 Jun 2009 14:38:30 +0000 Subject: Fix unaligned accesses by doing bytewise access until aligned, then continuing in 32-bit quantities. Fixes crash observed on sparc during FATE mlp test. Patch by Ramiro. Originally committed as revision 19200 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mlp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libavcodec/mlp.c') diff --git a/libavcodec/mlp.c b/libavcodec/mlp.c index c522617e0b..a290e465e5 100644 --- a/libavcodec/mlp.c +++ b/libavcodec/mlp.c @@ -96,6 +96,8 @@ uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size) uint32_t scratch = 0; const uint8_t *buf_end = buf + buf_size; + for (; ((intptr_t) buf & 3) && buf < buf_end; buf++) + scratch ^= *buf; for (; buf < buf_end - 3; buf += 4) scratch ^= *((const uint32_t*)buf); -- cgit v1.2.3