Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count
@ 2022-11-18 21:09 Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt() Michael Niedermayer
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-18 21:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: out of array access
Fixes: 52427/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4849108968144896

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

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index cde318d5e5..b962dce5a2 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -994,7 +994,7 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
     tile_count_y = (s->height + s->tile_length - 1) / s->tile_length;
 
     /* Iterate over the number of tiles */
-    for (tile_idx = 0; tile_idx < s->tile_count; tile_idx++) {
+    for (tile_idx = 0; tile_idx < tile_count_x * tile_count_y; tile_idx++) {
         tile_x = tile_idx % tile_count_x;
         tile_y = tile_idx / tile_count_x;
 
-- 
2.17.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt()
  2022-11-18 21:09 [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Michael Niedermayer
@ 2022-11-18 21:09 ` Michael Niedermayer
  2022-11-28 19:47   ` Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation Michael Niedermayer
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-18 21:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Timeout (read mostly the same data repeatly)
Fixes: 52457/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-6610706313379840

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

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 191a305ffb..cb31864045 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -377,10 +377,10 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen,
     lang[3] = '\0';
     taglen -= 3;
 
-    if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0)
+    if (decode_str(s, pb, encoding, &descriptor, &taglen) < 0 || taglen < 0)
         goto error;
 
-    if (decode_str(s, pb, encoding, &text, &taglen) < 0)
+    if (decode_str(s, pb, encoding, &text, &taglen) < 0 || taglen < 0)
         goto error;
 
     // FFmpeg does not support hierarchical metadata, so concatenate the keys.
-- 
2.17.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation
  2022-11-18 21:09 [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt() Michael Niedermayer
@ 2022-11-18 21:09 ` Michael Niedermayer
  2022-11-19  2:34   ` Shiyou Yin
  2022-11-28 19:46   ` Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors() Michael Niedermayer
  2022-11-19 12:40 ` [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Anton Khirnov
  3 siblings, 2 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-18 21:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Timeout
Fixes: 52566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4913160050311168

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

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index aca462428c..c3b2383dbc 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1216,6 +1216,9 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
     AVFrame *frame = s->pic[s->current_pic];
     int ret;
 
+    if (avctx->height/16 * (avctx->width/16) * 2 > 8LL*FFALIGN(pkt->size, 2))
+        return AVERROR_INVALIDDATA;
+
     av_fast_padded_malloc(&s->bitstream, &s->bitstream_size,
                           pkt->size);
 
-- 
2.17.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors()
  2022-11-18 21:09 [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt() Michael Niedermayer
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation Michael Niedermayer
@ 2022-11-18 21:09 ` Michael Niedermayer
  2022-11-18 23:03   ` Peter Ross
  2022-11-19 12:40 ` [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Anton Khirnov
  3 siblings, 1 reply; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-18 21:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: Timeout
Fixes: 52695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-4882310386548736

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

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 5d1a03158c..18cd99462e 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -137,7 +137,7 @@ static void seed_codebooks(VqcContext * s, const int * seed)
     }
 }
 
-static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
+static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
 {
     GetBitContext gb;
     uint8_t * vectors = s->vectors;
@@ -155,9 +155,11 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
         *dst++ = get_bits(&gb, 8);
 
         while (show_bits(&gb, 2) != 2) {
-
             if (dst >= vectors_end - 1)
-                return;
+                return 0;
+
+            if (get_bits_left(&gb) < 4)
+                return AVERROR_INVALIDDATA;
 
             if (!show_bits(&gb, 4)) {
                 *dst++ = 0;
@@ -182,6 +184,8 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
         skip_bits(&gb, 2);
         vectors += 32;
     }
+
+    return 0;
 }
 
 static void load_coeffs(VqcContext * s, const uint8_t * v, int width, int coeff_width)
@@ -392,7 +396,9 @@ static int vqc_decode_frame(AVCodecContext *avctx, AVFrame * rframe,
         avpriv_request_sample(avctx, "gamma=0x%x, contrast=0x%x\n", gamma, contrast);
 
     seed_codebooks(s, seed);
-    decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
+    ret = decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
+    if (ret < 0)
+        return ret;
     decode_frame(s, avctx->width, avctx->height);
 
     if ((ret = av_frame_ref(rframe, s->frame)) < 0)
-- 
2.17.1

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors()
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors() Michael Niedermayer
@ 2022-11-18 23:03   ` Peter Ross
  2022-11-19 20:04     ` Michael Niedermayer
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Ross @ 2022-11-18 23:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Fri, Nov 18, 2022 at 10:09:18PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 52695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-4882310386548736
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vqcdec.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
> index 5d1a03158c..18cd99462e 100644
> --- a/libavcodec/vqcdec.c
> +++ b/libavcodec/vqcdec.c
> @@ -137,7 +137,7 @@ static void seed_codebooks(VqcContext * s, const int * seed)
>      }
>  }
>  
> -static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
> +static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
>  {
>      GetBitContext gb;
>      uint8_t * vectors = s->vectors;
> @@ -155,9 +155,11 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
>          *dst++ = get_bits(&gb, 8);
>  
>          while (show_bits(&gb, 2) != 2) {
> -
>              if (dst >= vectors_end - 1)
> -                return;
> +                return 0;
> +
> +            if (get_bits_left(&gb) < 4)
> +                return AVERROR_INVALIDDATA;
>  
>              if (!show_bits(&gb, 4)) {
>                  *dst++ = 0;
> @@ -182,6 +184,8 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
>          skip_bits(&gb, 2);
>          vectors += 32;
>      }
> +
> +    return 0;
>  }
>  
>  static void load_coeffs(VqcContext * s, const uint8_t * v, int width, int coeff_width)
> @@ -392,7 +396,9 @@ static int vqc_decode_frame(AVCodecContext *avctx, AVFrame * rframe,
>          avpriv_request_sample(avctx, "gamma=0x%x, contrast=0x%x\n", gamma, contrast);
>  
>      seed_codebooks(s, seed);
> -    decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
> +    ret = decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
> +    if (ret < 0)
> +        return ret;
>      decode_frame(s, avctx->width, avctx->height);

please apply

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

[-- 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation Michael Niedermayer
@ 2022-11-19  2:34   ` Shiyou Yin
  2022-11-28 19:46   ` Michael Niedermayer
  1 sibling, 0 replies; 11+ messages in thread
From: Shiyou Yin @ 2022-11-19  2:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Please ignore fail info form loongarch64 patchwork temporarily.
I have stoped the service from Nov 16th, but there are still result post to patchwork.
Have mailed to Andriy to help analyze this problem together.

> 2022年11月19日 05:09,Michael Niedermayer <michael@niedermayer.cc> 写道:
> 
> Fixes: Timeout
> Fixes: 52566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4913160050311168
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavcodec/mobiclip.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
> index aca462428c..c3b2383dbc 100644
> --- a/libavcodec/mobiclip.c
> +++ b/libavcodec/mobiclip.c
> @@ -1216,6 +1216,9 @@ static int mobiclip_decode(AVCodecContext *avctx, AVFrame *rframe,
>     AVFrame *frame = s->pic[s->current_pic];
>     int ret;
> 
> +    if (avctx->height/16 * (avctx->width/16) * 2 > 8LL*FFALIGN(pkt->size, 2))
> +        return AVERROR_INVALIDDATA;
> +
>     av_fast_padded_malloc(&s->bitstream, &s->bitstream_size,
>                           pkt->size);
> 
> -- 
> 2.17.1
> 
> _______________________________________________
> 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count
  2022-11-18 21:09 [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Michael Niedermayer
                   ` (2 preceding siblings ...)
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors() Michael Niedermayer
@ 2022-11-19 12:40 ` Anton Khirnov
  2022-11-19 19:49   ` Michael Niedermayer
  3 siblings, 1 reply; 11+ messages in thread
From: Anton Khirnov @ 2022-11-19 12:40 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Michael Niedermayer (2022-11-18 22:09:15)
> Fixes: out of array access
> Fixes: 52427/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4849108968144896
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/tiff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index cde318d5e5..b962dce5a2 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -994,7 +994,7 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
>      tile_count_y = (s->height + s->tile_length - 1) / s->tile_length;
>  
>      /* Iterate over the number of tiles */
> -    for (tile_idx = 0; tile_idx < s->tile_count; tile_idx++) {
> +    for (tile_idx = 0; tile_idx < tile_count_x * tile_count_y; tile_idx++) {

Then why store tile_count at all? Seems to be it will just confuse
future readers.

If I'm reading the code correctly, the only other use of tile_count is
in setting has_tile_bits, but that also checks is_tiled, which is set
together with tile_count.

-- 
Anton Khirnov
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count
  2022-11-19 12:40 ` [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Anton Khirnov
@ 2022-11-19 19:49   ` Michael Niedermayer
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-19 19:49 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, Nov 19, 2022 at 01:40:06PM +0100, Anton Khirnov wrote:
> Quoting Michael Niedermayer (2022-11-18 22:09:15)
> > Fixes: out of array access
> > Fixes: 52427/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-4849108968144896
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/tiff.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> > index cde318d5e5..b962dce5a2 100644
> > --- a/libavcodec/tiff.c
> > +++ b/libavcodec/tiff.c
> > @@ -994,7 +994,7 @@ static int dng_decode_tiles(AVCodecContext *avctx, AVFrame *frame,
> >      tile_count_y = (s->height + s->tile_length - 1) / s->tile_length;
> >  
> >      /* Iterate over the number of tiles */
> > -    for (tile_idx = 0; tile_idx < s->tile_count; tile_idx++) {
> > +    for (tile_idx = 0; tile_idx < tile_count_x * tile_count_y; tile_idx++) {
> 
> Then why store tile_count at all? Seems to be it will just confuse
> future readers.
> 
> If I'm reading the code correctly, the only other use of tile_count is
> in setting has_tile_bits, but that also checks is_tiled, which is set
> together with tile_count.

i tend to make minimal changes with the bugfixes but yes you are correct
the field seems useless i will remove it in that patch

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.

[-- 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors()
  2022-11-18 23:03   ` Peter Ross
@ 2022-11-19 20:04     ` Michael Niedermayer
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-19 20:04 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Sat, Nov 19, 2022 at 10:03:08AM +1100, Peter Ross wrote:
> On Fri, Nov 18, 2022 at 10:09:18PM +0100, Michael Niedermayer wrote:
> > Fixes: Timeout
> > Fixes: 52695/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-4882310386548736
> > 
> > Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/vqcdec.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
> > index 5d1a03158c..18cd99462e 100644
> > --- a/libavcodec/vqcdec.c
> > +++ b/libavcodec/vqcdec.c
> > @@ -137,7 +137,7 @@ static void seed_codebooks(VqcContext * s, const int * seed)
> >      }
> >  }
> >  
> > -static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
> > +static int decode_vectors(VqcContext * s, const uint8_t * buf, int size, int width, int height)
> >  {
> >      GetBitContext gb;
> >      uint8_t * vectors = s->vectors;
> > @@ -155,9 +155,11 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
> >          *dst++ = get_bits(&gb, 8);
> >  
> >          while (show_bits(&gb, 2) != 2) {
> > -
> >              if (dst >= vectors_end - 1)
> > -                return;
> > +                return 0;
> > +
> > +            if (get_bits_left(&gb) < 4)
> > +                return AVERROR_INVALIDDATA;
> >  
> >              if (!show_bits(&gb, 4)) {
> >                  *dst++ = 0;
> > @@ -182,6 +184,8 @@ static void decode_vectors(VqcContext * s, const uint8_t * buf, int size, int wi
> >          skip_bits(&gb, 2);
> >          vectors += 32;
> >      }
> > +
> > +    return 0;
> >  }
> >  
> >  static void load_coeffs(VqcContext * s, const uint8_t * v, int width, int coeff_width)
> > @@ -392,7 +396,9 @@ static int vqc_decode_frame(AVCodecContext *avctx, AVFrame * rframe,
> >          avpriv_request_sample(avctx, "gamma=0x%x, contrast=0x%x\n", gamma, contrast);
> >  
> >      seed_codebooks(s, seed);
> > -    decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
> > +    ret = decode_vectors(s, buf + 7, avpkt->size - 7, avctx->width, avctx->height);
> > +    if (ret < 0)
> > +        return ret;
> >      decode_frame(s, avctx->width, avctx->height);
> 
> please apply

will apply

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.

[-- 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation Michael Niedermayer
  2022-11-19  2:34   ` Shiyou Yin
@ 2022-11-28 19:46   ` Michael Niedermayer
  1 sibling, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-28 19:46 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Fri, Nov 18, 2022 at 10:09:17PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 52566/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4913160050311168
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mobiclip.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.

[-- 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt()
  2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt() Michael Niedermayer
@ 2022-11-28 19:47   ` Michael Niedermayer
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Niedermayer @ 2022-11-28 19:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


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

On Fri, Nov 18, 2022 at 10:09:16PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout (read mostly the same data repeatly)
> Fixes: 52457/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-6610706313379840
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/id3v2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire

[-- 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".

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-11-28 19:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 21:09 [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Michael Niedermayer
2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 2/4] avformat/id3v2: Check taglen in read_uslt() Michael Niedermayer
2022-11-28 19:47   ` Michael Niedermayer
2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mobiclip: Check input size before (re)allocation Michael Niedermayer
2022-11-19  2:34   ` Shiyou Yin
2022-11-28 19:46   ` Michael Niedermayer
2022-11-18 21:09 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vqcdec: Check for end of input in decode_vectors() Michael Niedermayer
2022-11-18 23:03   ` Peter Ross
2022-11-19 20:04     ` Michael Niedermayer
2022-11-19 12:40 ` [FFmpeg-devel] [PATCH 1/4] avcodec/tiff: Ignore tile_count Anton Khirnov
2022-11-19 19:49   ` Michael Niedermayer

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