[FFmpeg-cvslog] lavc/qtrle: Do not use aligned writes for 24bit frames.

Carl Eugen Hoyos git at videolan.org
Fri Mar 15 02:11:43 EET 2019


ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Fri Mar 15 00:02:48 2019 +0100| [dbecf03f692a0a30aa401df90fd3e9a31c0e777d] | committer: Carl Eugen Hoyos

lavc/qtrle: Do not use aligned writes for 24bit frames.

pixel_ptr is 3 and leads to aligned access on odd memory addresses.
Fixes crashes on systems that do not allow unaligned access like sparc32.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dbecf03f692a0a30aa401df90fd3e9a31c0e777d
---

 libavcodec/qtrle.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index a744d7ba68..1cb3eb05bd 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -325,7 +325,7 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change
                 CHECK_PIXEL_PTR(rle_code * 3);
 
                 while (rle_code--) {
-                    AV_WN16A(rgb + pixel_ptr, rg);
+                    AV_WN16(rgb + pixel_ptr, rg);
                     rgb[pixel_ptr + 2] = b;
                     pixel_ptr += 3;
                 }
@@ -335,13 +335,13 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change
                 rle_code_half = rle_code / 2;
 
                 while (rle_code_half--) { /* copy 2 raw rgb value at the same time */
-                    AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); /* rgbr */
-                    AV_WN16A(rgb + pixel_ptr + 4, bytestream2_get_ne16(&s->g)); /* rgbr */
+                    AV_WN32(rgb + pixel_ptr, bytestream2_get_ne32(&s->g)); /* rgbr */
+                    AV_WN16(rgb + pixel_ptr + 4, bytestream2_get_ne16(&s->g)); /* rgbr */
                     pixel_ptr += 6;
                 }
 
                 if (rle_code % 2 != 0){ /* not even raw value */
-                    AV_WN16A(rgb + pixel_ptr, bytestream2_get_ne16(&s->g));
+                    AV_WN16(rgb + pixel_ptr, bytestream2_get_ne16(&s->g));
                     rgb[pixel_ptr + 2] = bytestream2_get_byte(&s->g);
                     pixel_ptr += 3;
                 }



More information about the ffmpeg-cvslog mailing list