Re: [FFmpeg-devel] [PATCH 1/7] avcodec/hcadec: do not set hfr_group_count to invalid values

2024-03-26 Thread Michael Niedermayer
On Tue, Mar 26, 2024 at 03:30:50AM +0100, Michael Niedermayer wrote:
> Fixes: 
> 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-6247136417087488
> Fixes: out of array write
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/hcadec.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

if there are no objections i will apply this patchset before making the 7.0 
branch

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

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/7] avcodec/hcadec: do not set hfr_group_count to invalid values

2024-03-25 Thread Michael Niedermayer
Fixes: 
62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCA_fuzzer-6247136417087488
Fixes: out of array write

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

diff --git a/libavcodec/hcadec.c b/libavcodec/hcadec.c
index 026b998341c..8c8c235f7b3 100644
--- a/libavcodec/hcadec.c
+++ b/libavcodec/hcadec.c
@@ -212,6 +212,7 @@ static int init_hca(AVCodecContext *avctx, const uint8_t 
*extradata,
 int8_t r[16] = { 0 };
 unsigned b, chunk;
 int version, ret;
+unsigned hfr_group_count;
 
 init_flush(avctx);
 
@@ -336,11 +337,12 @@ static int init_hca(AVCodecContext *avctx, const uint8_t 
*extradata,
 if (c->total_band_count < c->base_band_count)
 return AVERROR_INVALIDDATA;
 
-c->hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + 
c->stereo_band_count),
+hfr_group_count = ceil2(c->total_band_count - (c->base_band_count + 
c->stereo_band_count),
c->bands_per_hfr_group);
 
-if (c->base_band_count + c->stereo_band_count + (unsigned 
long)c->hfr_group_count > 128ULL)
+if (c->base_band_count + c->stereo_band_count + (uint64_t)hfr_group_count 
> 128ULL)
 return AVERROR_INVALIDDATA;
+c->hfr_group_count = hfr_group_count;
 
 for (int i = 0; i < avctx->ch_layout.nb_channels; i++) {
 c->ch[i].chan_type = r[i];
-- 
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-requ...@ffmpeg.org with subject "unsubscribe".