[FFmpeg-cvslog] arm: hpeldsp: prevent overreads in armv6 asm

Janne Grunau git at videolan.org
Tue Mar 11 11:01:26 CET 2014


ffmpeg | branch: release/2.2 | Janne Grunau <janne-libav at jannau.net> | Wed Mar  5 12:44:57 2014 +0100| [a1ab3300c83a16c2d5f5d29c51393668b9d92667] | committer: Janne Grunau

arm: hpeldsp: prevent overreads in armv6 asm

Based on a patch by Russel King <rmk+libav at arm.linux.org.uk>

Bug-Id: 646
CC: libav-stable at libav.org

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

 libavcodec/arm/hpeldsp_armv6.S |   20 ++++++++++++--------
 libavutil/arm/asm.S            |    7 +++++++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/libavcodec/arm/hpeldsp_armv6.S b/libavcodec/arm/hpeldsp_armv6.S
index f85c8cb..984e0f0 100644
--- a/libavcodec/arm/hpeldsp_armv6.S
+++ b/libavcodec/arm/hpeldsp_armv6.S
@@ -132,11 +132,12 @@ function ff_put_pixels8_y2_armv6, export=1
         uhadd8          r9,  r5,  r7
         eor             r11, r5,  r7
         and             r10, r10, r12
-        ldr_pre         r4,  r1,  r2
+        ldrc_pre        ne,  r4,  r1,  r2
         uadd8           r8,  r8,  r10
         and             r11, r11, r12
         uadd8           r9,  r9,  r11
-        ldr             r5,  [r1, #4]
+        it              ne
+        ldrne           r5,  [r1, #4]
         uhadd8          r10, r4,  r6
         eor             r6,  r4,  r6
         uhadd8          r11, r5,  r7
@@ -144,10 +145,11 @@ function ff_put_pixels8_y2_armv6, export=1
         eor             r7,  r5,  r7
         uadd8           r10, r10, r6
         and             r7,  r7,  r12
-        ldr_pre         r6,  r1,  r2
+        ldrc_pre        ne,  r6,  r1,  r2
         uadd8           r11, r11, r7
         strd_post       r8,  r9,  r0,  r2
-        ldr             r7,  [r1, #4]
+        it              ne
+        ldrne           r7,  [r1, #4]
         strd_post       r10, r11, r0,  r2
         bne             1b
 
@@ -192,13 +194,15 @@ function ff_put_pixels8_y2_no_rnd_armv6, export=1
 1:
         subs            r3,  r3,  #2
         uhadd8          r8,  r4,  r6
-        ldr_pre         r4,  r1,  r2
+        ldrc_pre        ne,  r4,  r1,  r2
         uhadd8          r9,  r5,  r7
-        ldr             r5,  [r1, #4]
+        it              ne
+        ldrne           r5,  [r1, #4]
         uhadd8          r12, r4,  r6
-        ldr_pre         r6,  r1,  r2
+        ldrc_pre        ne,  r6,  r1,  r2
         uhadd8          r14, r5,  r7
-        ldr             r7,  [r1, #4]
+        it              ne
+        ldrne           r7,  [r1, #4]
         stm             r0,  {r8,r9}
         add             r0,  r0,  r2
         stm             r0,  {r12,r14}
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 45fdf55..5884e17 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -216,6 +216,13 @@ T       ldr             \rt, [\rn]
 T       add             \rn, \rn, \rm
 .endm
 
+.macro  ldrc_pre        cc,  rt,  rn,  rm:vararg
+A       ldr\cc          \rt, [\rn, \rm]!
+T       itt             \cc
+T       add\cc          \rn, \rn, \rm
+T       ldr\cc          \rt, [\rn]
+.endm
+
 .macro  ldrd_reg        rt,  rt2, rn,  rm
 A       ldrd            \rt, \rt2, [\rn, \rm]
 T       add             \rt, \rn, \rm



More information about the ffmpeg-cvslog mailing list