diff mbox series

[FFmpeg-devel,1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k()

Message ID 20230802000135.26482-1-michael@niedermayer.cc
State Accepted
Commit 044ab532fcbbb457fce56c92b7ac99cfcc29a89a
Headers show
Series [FFmpeg-devel,1/3] avcodec/jpeg2000htdec: Avoid freeing uninitialized pointers in ff_jpeg2000_decode_htj2k() | 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

Michael Niedermayer Aug. 2, 2023, 12:01 a.m. UTC
Fixes: freeing of uninitialized pointers
Fixes: part of 58299

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/jpeg2000htdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tomas Härdin Aug. 3, 2023, 8:20 a.m. UTC | #1
ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> Fixes: freeing of uninitialized pointers
> Fixes: part of 58299
> 
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/jpeg2000htdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> index 4c4e54710d..2b082b3b2f 100644
> --- a/libavcodec/jpeg2000htdec.c
> +++ b/libavcodec/jpeg2000htdec.c
> @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
>      int ret;
>  
>      /* Temporary buffers */
> -    int32_t *sample_buf;
> -    uint8_t *block_states;
> +    int32_t *sample_buf = NULL;
> +    uint8_t *block_states = NULL;

Looks OK

/Tomas
Michael Niedermayer Aug. 3, 2023, 3:36 p.m. UTC | #2
On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > Fixes: freeing of uninitialized pointers
> > Fixes: part of 58299
> > 
> > Found-by: continuous fuzzing process
> > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/jpeg2000htdec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
> > index 4c4e54710d..2b082b3b2f 100644
> > --- a/libavcodec/jpeg2000htdec.c
> > +++ b/libavcodec/jpeg2000htdec.c
> > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> >      int ret;
> >  
> >      /* Temporary buffers */
> > -    int32_t *sample_buf;
> > -    uint8_t *block_states;
> > +    int32_t *sample_buf = NULL;
> > +    uint8_t *block_states = NULL;
> 
> Looks OK

will apply

thx

[...]
Tomas Härdin Aug. 3, 2023, 8:50 p.m. UTC | #3
tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > Fixes: freeing of uninitialized pointers
> > > Fixes: part of 58299
> > > 
> > > Found-by: continuous fuzzing process
> > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > ---
> > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/libavcodec/jpeg2000htdec.c
> > > b/libavcodec/jpeg2000htdec.c
> > > index 4c4e54710d..2b082b3b2f 100644
> > > --- a/libavcodec/jpeg2000htdec.c
> > > +++ b/libavcodec/jpeg2000htdec.c
> > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > >      int ret;
> > >  
> > >      /* Temporary buffers */
> > > -    int32_t *sample_buf;
> > > -    uint8_t *block_states;
> > > +    int32_t *sample_buf = NULL;
> > > +    uint8_t *block_states = NULL;
> > 
> > Looks OK
> 
> will apply

I should add that I don't know if the two other patches are fine

/Tomas
Pierre-Anthony Lemieux Aug. 3, 2023, 8:58 p.m. UTC | #4
On Thu, Aug 3, 2023 at 1:50 PM Tomas Härdin <git@haerdin.se> wrote:
>
> tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> > On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > > Fixes: freeing of uninitialized pointers
> > > > Fixes: part of 58299
> > > >
> > > > Found-by: continuous fuzzing process
> > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > > ---
> > > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/libavcodec/jpeg2000htdec.c
> > > > b/libavcodec/jpeg2000htdec.c
> > > > index 4c4e54710d..2b082b3b2f 100644
> > > > --- a/libavcodec/jpeg2000htdec.c
> > > > +++ b/libavcodec/jpeg2000htdec.c
> > > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > > >      int ret;
> > > >
> > > >      /* Temporary buffers */
> > > > -    int32_t *sample_buf;
> > > > -    uint8_t *block_states;
> > > > +    int32_t *sample_buf = NULL;
> > > > +    uint8_t *block_states = NULL;
> > >
> > > Looks OK
> >
> > will apply
>
> I should add that I don't know if the two other patches are fine

I am working on them.

>
> /Tomas
> _______________________________________________
> 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".
Caleb Etemesi Aug. 4, 2023, 3:36 a.m. UTC | #5
Looks good, for the other two, I may need to check with a problematic
sample I had to see if it works

Kind regards,
Caleb Etemesi

On Thu, 3 Aug 2023, 23:58 Pierre-Anthony Lemieux, <pal@sandflow.com> wrote:

> On Thu, Aug 3, 2023 at 1:50 PM Tomas Härdin <git@haerdin.se> wrote:
> >
> > tor 2023-08-03 klockan 17:36 +0200 skrev Michael Niedermayer:
> > > On Thu, Aug 03, 2023 at 10:20:29AM +0200, Tomas Härdin wrote:
> > > > ons 2023-08-02 klockan 02:01 +0200 skrev Michael Niedermayer:
> > > > > Fixes: freeing of uninitialized pointers
> > > > > Fixes: part of 58299
> > > > >
> > > > > Found-by: continuous fuzzing process
> > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > > > > ---
> > > > >  libavcodec/jpeg2000htdec.c | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/jpeg2000htdec.c
> > > > > b/libavcodec/jpeg2000htdec.c
> > > > > index 4c4e54710d..2b082b3b2f 100644
> > > > > --- a/libavcodec/jpeg2000htdec.c
> > > > > +++ b/libavcodec/jpeg2000htdec.c
> > > > > @@ -1174,8 +1174,8 @@ ff_jpeg2000_decode_htj2k(const
> > > > > Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
> > > > >      int ret;
> > > > >
> > > > >      /* Temporary buffers */
> > > > > -    int32_t *sample_buf;
> > > > > -    uint8_t *block_states;
> > > > > +    int32_t *sample_buf = NULL;
> > > > > +    uint8_t *block_states = NULL;
> > > >
> > > > Looks OK
> > >
> > > will apply
> >
> > I should add that I don't know if the two other patches are fine
>
> I am working on them.
>
> >
> > /Tomas
> > _______________________________________________
> > 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".
> _______________________________________________
> 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".
>
diff mbox series

Patch

diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c
index 4c4e54710d..2b082b3b2f 100644
--- a/libavcodec/jpeg2000htdec.c
+++ b/libavcodec/jpeg2000htdec.c
@@ -1174,8 +1174,8 @@  ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
     int ret;
 
     /* Temporary buffers */
-    int32_t *sample_buf;
-    uint8_t *block_states;
+    int32_t *sample_buf = NULL;
+    uint8_t *block_states = NULL;
 
     int32_t n, val;             // Post-processing