[FFmpeg-devel] [PATCH] postproc: fix unaligned access

Michael Niedermayer michaelni at gmx.at
Fri Jun 19 01:34:57 CEST 2015


On Fri, Jun 19, 2015 at 12:05:50AM +0200, Andreas Cadhalpun wrote:
> On 18.06.2015 22:26, Michael Niedermayer wrote:
> > On Thu, Jun 18, 2015 at 08:29:06PM +0200, Andreas Cadhalpun wrote:
> >> QP_store is only 8-bit-aligned, so accessing it as uint32_t causes
> >> SIGILL crashes on sparc.
> >>
> >> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> >> ---
> >>  libpostproc/postprocess.c | 5 +----
> >>  1 file changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
> >> index 92cc436..e4ea515 100644
> >> --- a/libpostproc/postprocess.c
> >> +++ b/libpostproc/postprocess.c
> >> @@ -996,10 +996,7 @@ void  pp_postprocess(const uint8_t * src[3], const int srcStride[3],
> >>          if (QPStride >= 0){
> >>              int i;
> >>              const int count= FFMAX(mbHeight * QPStride, mbWidth);
> >> -            for(i=0; i<(count>>2); i++){
> >> -                ((uint32_t*)c->nonBQPTable)[i] = ((const uint32_t*)QP_store)[i] & 0x3F3F3F3F;
> >> -            }
> >> -            for(i<<=2; i<count; i++){
> > 
> > maybe this can be left under #if HAVE_FAST_UNALIGNED with
> > AV_RN32 AV_WN32
> 
> Yes, updated patch attached.
> 
> Best regards,
> Andreas

>  postprocess.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 09c6ba371eb89ee2767b642b731ed6d192e9bcf3  0001-postproc-fix-unaligned-access.patch
> From 92662bfcebb5a49b3f6728d18582f1ae7205bcb3 Mon Sep 17 00:00:00 2001
> From: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> Date: Thu, 18 Jun 2015 20:15:12 +0200
> Subject: [PATCH] postproc: fix unaligned access
> 
> QP_store is only 8-bit-aligned, so accessing it as uint32_t causes
> SIGBUS crashes on sparc.
> The AV_RN32/AV_WN32 macros only do unaligned access in the
> HAVE_FAST_UNALIGNED case.

LGTM

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150619/16b915c1/attachment.asc>


More information about the ffmpeg-devel mailing list