diff mbox series

[FFmpeg-devel] avcodec/lcldec: fix uncompressed buffer size calculation

Message ID CAPYw7P4-Tn3oPUJd9cQ7Ff=pc_wy3C+2UYjrkk4X_tYwD1Moaw@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/lcldec: fix uncompressed buffer size calculation | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Paul B Mahol Sept. 30, 2023, 10:36 a.m. UTC
Attached.

Comments

Paul B Mahol Oct. 2, 2023, 2:23 p.m. UTC | #1
On 9/30/23, Paul B Mahol <onemda@gmail.com> wrote:
> Attached.
>

Gonna apply soon.
Michael Niedermayer Oct. 2, 2023, 7 p.m. UTC | #2
Hi Paul

On Mon, Oct 02, 2023 at 04:23:54PM +0200, Paul B Mahol wrote:
> On 9/30/23, Paul B Mahol <onemda@gmail.com> wrote:
> > Attached.
> >
> 
> Gonna apply soon.

Did you look at
"avcodec/lcldec: Make PNG filter addressing match the code afterwards"

You patch is simpler (which is good)
but it leaves some pixel addressing unchanged, it just changes the
check.
Just want to make sure that is intended

thx

[...]
Paul B Mahol Oct. 2, 2023, 7:42 p.m. UTC | #3
On 10/2/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Hi Paul
>
> On Mon, Oct 02, 2023 at 04:23:54PM +0200, Paul B Mahol wrote:
>> On 9/30/23, Paul B Mahol <onemda@gmail.com> wrote:
>> > Attached.
>> >
>>
>> Gonna apply soon.
>
> Did you look at
> "avcodec/lcldec: Make PNG filter addressing match the code afterwards"
>
> You patch is simpler (which is good)
> but it leaves some pixel addressing unchanged, it just changes the
> check.
> Just want to make sure that is intended

Why that patch is not applied?

>
> thx
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
>
Michael Niedermayer Oct. 3, 2023, 1:55 p.m. UTC | #4
On Mon, Oct 02, 2023 at 09:42:25PM +0200, Paul B Mahol wrote:
> On 10/2/23, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > Hi Paul
> >
> > On Mon, Oct 02, 2023 at 04:23:54PM +0200, Paul B Mahol wrote:
> >> On 9/30/23, Paul B Mahol <onemda@gmail.com> wrote:
> >> > Attached.
> >> >
> >>
> >> Gonna apply soon.
> >
> > Did you look at
> > "avcodec/lcldec: Make PNG filter addressing match the code afterwards"
> >
> > You patch is simpler (which is good)
> > but it leaves some pixel addressing unchanged, it just changes the
> > check.
> > Just want to make sure that is intended
> 
> Why that patch is not applied?

I forgot, i will apply it

thx


[...]
diff mbox series

Patch

From efa34f7cd140f4e696641ce730b8e2b97e3d8452 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sat, 30 Sep 2023 12:33:58 +0200
Subject: [PATCH] avcodec/lcldec: fix uncompressed buffer size calculation

The width is truncated to multiple of 2.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/lcldec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c
index 11e28683ba..3168f9697f 100644
--- a/libavcodec/lcldec.c
+++ b/libavcodec/lcldec.c
@@ -248,7 +248,7 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
                 bppx2 = 0; // will error out below
                 break;
             }
-            if (len < ((width * height * bppx2) >> 1))
+            if (len < (((width & 0xFFFFFFFC) * height * bppx2) >> 1))
                 return AVERROR_INVALIDDATA;
             break;
         }
-- 
2.42.0