diff options
author | Peter Ross <pross@xvid.org> | 2019-06-21 00:52:31 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-30 12:06:38 +0300 |
commit | fd172185580c1ccdcfb90bbfdb59fa806fad3117 (patch) | |
tree | 97743b09c37d6cecc1f231e31800fcbe1eb80d15 /libavcodec/vp3.c | |
parent | d3dee676b8a8ab6752c599e25c9b5461f06a3959 (diff) |
vp4: prevent unaligned memory access in loop filter
VP4 applies a loop filter during motion compensation, causing the block offset
will often by unaligned. This produces a bus error on some platforms, namely
ARMv7 NEON.
This patch adds a unaligned version of the loop filter function pointer
to VP3DSPContext.
Reported-by: Mike Melanson <mike@multimedia.cx>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r-- | libavcodec/vp3.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index a2bd2ef07d..9a3821a8b9 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2031,11 +2031,17 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int plane, int motion_x, int plane_width, plane_height); +#define safe_loop_filter(name, ptr, stride, bounding_values) \ + if ((uintptr_t)(ptr) & 7) \ + s->vp3dsp.name##_unaligned(ptr, stride, bounding_values); \ + else \ + s->vp3dsp.name(ptr, stride, bounding_values); + if (x_offset) - s->vp3dsp.h_loop_filter(loop + loop_stride + x_offset + 1, loop_stride, bounding_values); + safe_loop_filter(h_loop_filter, loop + loop_stride + x_offset + 1, loop_stride, bounding_values); if (y_offset) - s->vp3dsp.v_loop_filter(loop + (y_offset + 1)*loop_stride + 1, loop_stride, bounding_values); + safe_loop_filter(v_loop_filter, loop + (y_offset + 1)*loop_stride + 1, loop_stride, bounding_values); } for (i = 0; i < 9; i++) |