Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/qpeldsp: copy less for the mc0x cases
Date: Mon, 27 Jun 2022 14:40:04 +0200
Message-ID: <20220627124004.GS396728@pb2> (raw)
In-Reply-To: <DB6PR0101MB22148DA559EE851AB03B5D9F8FB99@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com>


[-- Attachment #1.1: Type: text/plain, Size: 6260 bytes --]

On Mon, Jun 27, 2022 at 07:57:06AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > Fixes: out of array access
> > Fixes: 47936/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5745039940124672
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/qpeldsp.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/libavcodec/qpeldsp.c b/libavcodec/qpeldsp.c
> > index 2b9146ceb1..5f937f9d9e 100644
> > --- a/libavcodec/qpeldsp.c
> > +++ b/libavcodec/qpeldsp.c
> > @@ -199,7 +199,7 @@ static void OPNAME ## qpel8_mc01_c(uint8_t *dst, const uint8_t *src,          \
> >      uint8_t full[16 * 9];                                                     \
> >      uint8_t half[64];                                                         \
> >                                                                                \
> > -    copy_block9(full, src, 16, stride, 9);                                    \
> > +    copy_block8(full, src, 16, stride, 9);                                    \
> >      put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);                   \
> >      OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8);                \
> >  }                                                                             \
> > @@ -209,7 +209,7 @@ static void OPNAME ## qpel8_mc02_c(uint8_t *dst, const uint8_t *src,          \
> >  {                                                                             \
> >      uint8_t full[16 * 9];                                                     \
> >                                                                                \
> > -    copy_block9(full, src, 16, stride, 9);                                    \
> > +    copy_block8(full, src, 16, stride, 9);                                    \
> >      OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);                   \
> >  }                                                                             \
> >                                                                                \
> > @@ -219,7 +219,7 @@ static void OPNAME ## qpel8_mc03_c(uint8_t *dst, const uint8_t *src,          \
> >      uint8_t full[16 * 9];                                                     \
> >      uint8_t half[64];                                                         \
> >                                                                                \
> > -    copy_block9(full, src, 16, stride, 9);                                    \
> > +    copy_block8(full, src, 16, stride, 9);                                    \
> >      put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16);                   \
> >      OPNAME ## pixels8_l2_8(dst, full + 16, half, stride, 16, 8, 8);           \
> >  }                                                                             \
> > @@ -459,7 +459,7 @@ static void OPNAME ## qpel16_mc01_c(uint8_t *dst, const uint8_t *src,         \
> >      uint8_t full[24 * 17];                                                    \
> >      uint8_t half[256];                                                        \
> >                                                                                \
> > -    copy_block17(full, src, 24, stride, 17);                                  \
> > +    copy_block16(full, src, 24, stride, 17);                                  \
> >      put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);                 \
> >      OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16);             \
> >  }                                                                             \
> > @@ -469,7 +469,7 @@ static void OPNAME ## qpel16_mc02_c(uint8_t *dst, const uint8_t *src,         \
> >  {                                                                             \
> >      uint8_t full[24 * 17];                                                    \
> >                                                                                \
> > -    copy_block17(full, src, 24, stride, 17);                                  \
> > +    copy_block16(full, src, 24, stride, 17);                                  \
> >      OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);                  \
> >  }                                                                             \
> >                                                                                \
> > @@ -479,7 +479,7 @@ static void OPNAME ## qpel16_mc03_c(uint8_t *dst, const uint8_t *src,         \
> >      uint8_t full[24 * 17];                                                    \
> >      uint8_t half[256];                                                        \
> >                                                                                \
> > -    copy_block17(full, src, 24, stride, 17);                                  \
> > +    copy_block16(full, src, 24, stride, 17);                                  \
> >      put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24);                 \
> >      OPNAME ## pixels16_l2_8(dst, full + 24, half, stride, 24, 16, 16);        \
> >  }                                                                             \
> 
> Are the arch-specific dsp functions affected by this, too?

the fuzzer sample does not cause a anomaly in the x86 functions


> Do you happen to know why copy_block9/17 has been used in this code?

probably because there was asm anyway so it was unused code or maybe it
was oversight or some sort of code sharing/code cache use reduction but
these hypothesis dont fit entirely. so i dont really know/rememeber


> (After all, using copy_block8/16 should result in a slight speedup, so I
> using copy_block9/17 must have been intentional.)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Homeopathy is like voting while filling the ballot out with transparent ink.
Sometimes the outcome one wanted occurs. Rarely its worse than filling out
a ballot properly.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2022-06-27 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 13:51 Michael Niedermayer
2022-06-27  5:57 ` Andreas Rheinhardt
2022-06-27 12:40   ` Michael Niedermayer [this message]
2022-07-12 18:13     ` Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220627124004.GS396728@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git