diff mbox series

[FFmpeg-devel] vp9: don't overread by 4 pixels in ff_vp9_avg4_mmxext().

Message ID 20220531132130.60467-1-rsbultje@gmail.com
State Accepted
Commit 6e13c30a8fd45e14303ef4a8e4da3554d5b4ba8e
Headers show
Series [FFmpeg-devel] vp9: don't overread by 4 pixels in ff_vp9_avg4_mmxext(). | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Ronald S. Bultje May 31, 2022, 1:21 p.m. UTC
If the block is at the end of the allocated buffer and there is no
padding, this will over-read, which may cause crashes. Reported by
Firefox.
---
 libavcodec/x86/vp9mc.asm | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ronald S. Bultje June 1, 2022, 6:32 p.m. UTC | #1
Hi,

On Tue, May 31, 2022 at 9:21 AM Ronald S. Bultje <rsbultje@gmail.com> wrote:

> If the block is at the end of the allocated buffer and there is no
> padding, this will over-read, which may cause crashes. Reported by
> Firefox.
> ---
>  libavcodec/x86/vp9mc.asm | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/x86/vp9mc.asm b/libavcodec/x86/vp9mc.asm
> index f64161b2c2..efc4cfbef1 100644
> --- a/libavcodec/x86/vp9mc.asm
> +++ b/libavcodec/x86/vp9mc.asm
> @@ -604,7 +604,12 @@ cglobal vp9_%1%2 %+ %%szsuf, 5, 5, %8, dst, dstride,
> src, sstride, h
>      %%pavg      m0, [dstq]
>      %%pavg      m1, [dstq+d%3]
>      %%pavg      m2, [dstq+d%4]
> +%if %2 == 4
> +    %%srcfn     m4, [dstq+d%5]
> +    %%pavg      m3, m4
> +%else
>      %%pavg      m3, [dstq+d%5]
> +%endif
>  %if %2/mmsize == 8
>      %%pavg      m4, [dstq+mmsize*4]
>      %%pavg      m5, [dstq+mmsize*5]
> --
> 2.34.1
>

Merged.

Ronald
diff mbox series

Patch

diff --git a/libavcodec/x86/vp9mc.asm b/libavcodec/x86/vp9mc.asm
index f64161b2c2..efc4cfbef1 100644
--- a/libavcodec/x86/vp9mc.asm
+++ b/libavcodec/x86/vp9mc.asm
@@ -604,7 +604,12 @@  cglobal vp9_%1%2 %+ %%szsuf, 5, 5, %8, dst, dstride, src, sstride, h
     %%pavg      m0, [dstq]
     %%pavg      m1, [dstq+d%3]
     %%pavg      m2, [dstq+d%4]
+%if %2 == 4
+    %%srcfn     m4, [dstq+d%5]
+    %%pavg      m3, m4
+%else
     %%pavg      m3, [dstq+d%5]
+%endif
 %if %2/mmsize == 8
     %%pavg      m4, [dstq+mmsize*4]
     %%pavg      m5, [dstq+mmsize*5]