Re: [FFmpeg-devel] [PATCH] dca: fix misaligned access in avpriv_dca_convert_bitstream

2016-01-13 Thread Andreas Cadhalpun
On 13.01.2016 20:07, Michael Niedermayer wrote:
> On Wed, Jan 13, 2016 at 12:56:39AM +0100, Andreas Cadhalpun wrote:
>> src and dst are only 8-bit-aligned, so accessing them as uint16_t causes
>> SIGBUS crashes on architectures like sparc.
>>
>> This fixes ubsan runtime error: load of misaligned address for type
>> 'const uint16_t', which requires 2 byte alignment
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/dca.c | 9 +
>>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> LGTM

Pushed.

Best regards,
Andreas

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] dca: fix misaligned access in avpriv_dca_convert_bitstream

2016-01-13 Thread Michael Niedermayer
On Wed, Jan 13, 2016 at 12:56:39AM +0100, Andreas Cadhalpun wrote:
> src and dst are only 8-bit-aligned, so accessing them as uint16_t causes
> SIGBUS crashes on architectures like sparc.
> 
> This fixes ubsan runtime error: load of misaligned address for type
> 'const uint16_t', which requires 2 byte alignment
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
>  libavcodec/dca.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)

LGTM

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] dca: fix misaligned access in avpriv_dca_convert_bitstream

2016-01-12 Thread Andreas Cadhalpun
src and dst are only 8-bit-aligned, so accessing them as uint16_t causes
SIGBUS crashes on architectures like sparc.

This fixes ubsan runtime error: load of misaligned address for type
'const uint16_t', which requires 2 byte alignment

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/dca.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 8dd0430..714509b 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -41,8 +41,6 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int 
src_size, uint8_t *dst,
 {
 uint32_t mrk;
 int i, tmp;
-const uint16_t *ssrc = (const uint16_t *) src;
-uint16_t *sdst = (uint16_t *) dst;
 PutBitContext pb;
 
 if ((unsigned) src_size > (unsigned) max_size)
@@ -54,8 +52,11 @@ int avpriv_dca_convert_bitstream(const uint8_t *src, int 
src_size, uint8_t *dst,
 memcpy(dst, src, src_size);
 return src_size;
 case DCA_SYNCWORD_CORE_LE:
-for (i = 0; i < (src_size + 1) >> 1; i++)
-*sdst++ = av_bswap16(*ssrc++);
+for (i = 0; i < (src_size + 1) >> 1; i++) {
+AV_WB16(dst, AV_RL16(src));
+src += 2;
+dst += 2;
+}
 return src_size;
 case DCA_SYNCWORD_CORE_14B_BE:
 case DCA_SYNCWORD_CORE_14B_LE:
-- 
2.6.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel