From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 5782D4FE17 for ; Thu, 3 Jul 2025 02:01:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 5BC5668E4E7; Thu, 3 Jul 2025 05:01:40 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id B7DF568E3D6 for ; Thu, 3 Jul 2025 05:01:33 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0320843921 for ; Thu, 3 Jul 2025 02:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751508093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=8OFtxFCEtG8gqsUKkLbwmyI610TAj0j3RR1YQlDyZxA=; b=N1F2ZTbICKETbWKpXKau7j10a3JuylcC6X+v2bpye4h/E/hzr2Bw3WKVtwpnJyqiEYfi2G w+Y+ukCRdKEnmsrIxJM9ZlGXZcRhPaX6Nsx1xhNqZnSU/HpY/UGlNUZQc4r7DO5dTR4X8X 2Ipbj8yKjBAd4/PI+/8WONJyLFXflF8t7EW+caYUpHpKB9iTesKV6jawviTmEAJeu7A+ea qf/nY/ZaCGAnlf9SBeszJib/KKDAORAzGa0ISxFERsXUM4U6gohqJhyd/I28ESXVCHkSir EmHHd1YUUD2ep6NTK2n90DwmbWBkGQZJ4POcMRivFg08dsmb99Vd0IZlh5lGPg== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 3 Jul 2025 04:01:27 +0200 Message-ID: <20250703020131.2506428-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduledtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepjeffueefffevvedthfeuvedtfeejteehieetffehteegvdduudevtdfffeejhfelnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepgedurdeiiedrieeirddvvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieeirddvvdejpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/smacker: Move buffer allocation to later X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Reduces allocations on random input Fixes: 421650030/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-6144441767493632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/smacker.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index db464dfcf7d..bd08bc7be28 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -641,10 +641,6 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, "The buffer does not contain an integer number of samples\n"); return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = (int16_t *)frame->data[0]; - samples8 = frame->data[0]; // Initialize for(i = 0; i < (1 << (bits + stereo)); i++) { @@ -666,6 +662,12 @@ static int smka_decode_frame(AVCodecContext *avctx, AVFrame *frame, } else values[i] = h.entries[0].value; } + + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; + samples = (int16_t *)frame->data[0]; + samples8 = frame->data[0]; + /* this codec relies on wraparound instead of clipping audio */ if(bits) { //decode 16-bit data for(i = stereo; i >= 0; i--) -- 2.49.0 _______________________________________________ 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".