[FFmpeg-devel] lavc/qtrle: Do not use aligned writes for odd addresses.

Submitted by Carl Eugen Hoyos on March 15, 2019, 12:23 a.m.

Details

Message ID CAB0OVGo8iR4qX=ghfHzz+WYH=o-38BT1BMDbJ51Ao4VS-O+5wA@mail.gmail.com
State New
Headers show

Commit Message

Carl Eugen Hoyos March 15, 2019, 12:23 a.m.
2019-03-15 0:41 GMT+01:00, Hendrik Leppkes <h.leppkes@gmail.com>:
> On Fri, Mar 15, 2019 at 12:26 AM Carl Eugen Hoyos <ceffmpeg@gmail.com>
> wrote:
>>
>> 2019-03-15 0:13 GMT+01:00, Hendrik Leppkes <h.leppkes@gmail.com>:
>> > On Fri, Mar 15, 2019 at 12:05 AM Carl Eugen Hoyos <ceffmpeg@gmail.com>
>> > wrote:
>> >>
>> >> Hi!
>> >>
>> >> Attached patch fixes the qtrle crash on sparc for me.
>> >>
>> >
>> > It should be fine in cases where the pointer is being incremented by
>> > an aligned amount, ie. writing 32 and incrementing by 4, or 64 and 8,
>> > etc.
>>
>> Of course, thank you for the review!
>> New patch attached.
>>
>
> LGTM if tested.

I pushed the patch that fixed the crash on 32bit sparc
which I had tested first.

Attached patch fixes another fate crash on 64bit sparc, I
don't know if the change is sufficient for all use cases,
it passes fate.

The crash happens with pixel_ptr = 2852, rgb is 16-byte aligned.

Please comment, Carl Eugen

Patch hide | download patch | download mbox

From a7f5fe1d72aef47e46505f94ad247af5486b43de Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Fri, 15 Mar 2019 01:14:58 +0100
Subject: [PATCH] lavc/qtrle: Do not use aligned 64bit write.

Fixes a crash on sparc64.
---
 libavcodec/qtrle.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index 1cb3eb0..1613530 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -388,7 +388,7 @@  static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change
                 /* copy pixels directly to output */
                 rle_code_half = rle_code / 2;
                 while (rle_code_half--) { /* copy 2 argb raw value at the same time */
-                    AV_WN64A(rgb + pixel_ptr, bytestream2_get_ne64(&s->g));
+                    AV_WN64(rgb + pixel_ptr, bytestream2_get_ne64(&s->g));
                     pixel_ptr += 8;
                 }
 
-- 
1.7.10.4