* [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf
@ 2023-01-24 23:42 Michael Niedermayer
2023-01-24 23:42 ` [FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for EXR Michael Niedermayer
2023-04-22 21:18 ` [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf Michael Niedermayer
0 siblings, 2 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-01-24 23:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
framebuf is only allocated when the new width/height are larger than the old
but nothing sets the old so its always allocated.
Use av_fast_mallocz() instead.
Fixes: Timeout
Fixes: 55094/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5116909932904448
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavcodec/g2meet.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 761fd22fc3..7363c2212d 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -145,7 +145,8 @@ typedef struct G2MContext {
int got_header;
uint8_t *framebuf;
- int framebuf_stride, old_width, old_height;
+ int framebuf_stride;
+ unsigned int framebuf_allocated;
uint8_t *synth_tile, *jpeg_tile, *epic_buf, *epic_buf_base;
int tile_stride, epic_buf_stride, old_tile_w, old_tile_h;
@@ -1160,14 +1161,13 @@ static int g2m_init_buffers(G2MContext *c)
{
int aligned_height;
- if (!c->framebuf || c->old_width < c->width || c->old_height < c->height) {
- c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
- aligned_height = c->height + 15;
- av_free(c->framebuf);
- c->framebuf = av_calloc(c->framebuf_stride, aligned_height);
- if (!c->framebuf)
- return AVERROR(ENOMEM);
- }
+ c->framebuf_stride = FFALIGN(c->width + 15, 16) * 3;
+ aligned_height = c->height + 15;
+
+ av_fast_mallocz(&c->framebuf, &c->framebuf_allocated, c->framebuf_stride * aligned_height);
+ if (!c->framebuf)
+ return AVERROR(ENOMEM);
+
if (!c->synth_tile || !c->jpeg_tile ||
(c->compression == 2 && !c->epic_buf_base) ||
c->old_tile_w < c->tile_width ||
@@ -1617,6 +1617,7 @@ static av_cold int g2m_decode_end(AVCodecContext *avctx)
av_freep(&c->jpeg_tile);
av_freep(&c->cursor);
av_freep(&c->framebuf);
+ c->framebuf_allocated = 0;
return 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] 3+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for EXR
2023-01-24 23:42 [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf Michael Niedermayer
@ 2023-01-24 23:42 ` Michael Niedermayer
2023-04-22 21:18 ` [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-01-24 23:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: Timeout
Fixes: 55106/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5052199338377216
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
tools/target_dec_fuzzer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index a20345db5c..0d532afea9 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -226,6 +226,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
case AV_CODEC_ID_DVB_SUBTITLE: av_dict_set_int(&opts, "compute_clut", -2, 0); break;
case AV_CODEC_ID_DXA: maxpixels /= 32; break;
case AV_CODEC_ID_DXV: maxpixels /= 32; break;
+ case AV_CODEC_ID_EXR: maxpixels /= 1024; break;
case AV_CODEC_ID_FFV1: maxpixels /= 32; break;
case AV_CODEC_ID_FFWAVESYNTH: maxsamples /= 16384; break;
case AV_CODEC_ID_FLAC: maxsamples /= 1024; break;
--
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] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf
2023-01-24 23:42 [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf Michael Niedermayer
2023-01-24 23:42 ` [FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for EXR Michael Niedermayer
@ 2023-04-22 21:18 ` Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2023-04-22 21:18 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1020 bytes --]
On Wed, Jan 25, 2023 at 12:42:53AM +0100, Michael Niedermayer wrote:
> framebuf is only allocated when the new width/height are larger than the old
> but nothing sets the old so its always allocated.
> Use av_fast_mallocz() instead.
>
> Fixes: Timeout
> Fixes: 55094/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5116909932904448
>
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
> libavcodec/g2meet.c | 19 ++++++++++---------
> 1 file changed, 10 insertions(+), 9 deletions(-)
will apply patchset
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
[-- 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] 3+ messages in thread
end of thread, other threads:[~2023-04-22 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 23:42 [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf Michael Niedermayer
2023-01-24 23:42 ` [FFmpeg-devel] [PATCH 2/2] tools/target_dec_fuzzer: Adjust threshold for EXR Michael Niedermayer
2023-04-22 21:18 ` [FFmpeg-devel] [PATCH 1/2] avcodec/g2meet: Replace fake allocation avoidance for framebuf 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