This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new d138169966 avcodec/libvorbisdec: output AV_SAMPLE_FMT_FLTP
d138169966 is described below
commit d138169966c113d4c8ce6090e8ac849c217742d3
Author: Michael Niedermayer <[email protected]>
AuthorDate: Tue Feb 10 16:08:41 2026 +0100
Commit: michaelni <[email protected]>
CommitDate: Wed Feb 18 23:38:16 2026 +0000
avcodec/libvorbisdec: output AV_SAMPLE_FMT_FLTP
This removes the internal sample format convert
Fixes: nan is outside the range of representable values of type 'int'
Fixes:
471946097/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_DEC_fuzzer-4843605174059008
Signed-off-by: Michael Niedermayer <[email protected]>
---
libavcodec/libvorbisdec.c | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c
index 326ed4b4fe..b38f423b9f 100644
--- a/libavcodec/libvorbisdec.c
+++ b/libavcodec/libvorbisdec.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <string.h>
#include <vorbis/vorbisenc.h>
#include "avcodec.h"
@@ -124,7 +125,7 @@ static av_cold int oggvorbis_decode_init(AVCodecContext
*avccontext)
avccontext->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC;
avccontext->ch_layout.nb_channels = context->vi.channels;
avccontext->sample_rate = context->vi.rate;
- avccontext->sample_fmt = AV_SAMPLE_FMT_S16;
+ avccontext->sample_fmt = AV_SAMPLE_FMT_FLTP;
avccontext->time_base= (AVRational){1, avccontext->sample_rate};
vorbis_synthesis_init(&context->vd, &context->vi);
@@ -138,33 +139,14 @@ static av_cold int oggvorbis_decode_init(AVCodecContext
*avccontext)
}
-static inline int conv(int samples, float **pcm, char *buf, int channels) {
- int i, j;
- ogg_int16_t *ptr, *data = (ogg_int16_t*)buf ;
- float *mono ;
-
- for(i = 0 ; i < channels ; i++){
- ptr = &data[i];
- mono = pcm[i] ;
-
- for(j = 0 ; j < samples ; j++) {
- *ptr = av_clip_int16(mono[j] * 32767.f);
- ptr += channels;
- }
- }
-
- return 0 ;
-}
-
static int oggvorbis_decode_frame(AVCodecContext *avccontext, AVFrame *frame,
int *got_frame_ptr, AVPacket *avpkt)
{
OggVorbisDecContext *context = avccontext->priv_data ;
float **pcm ;
ogg_packet *op= &context->op;
- int samples, total_samples, total_bytes;
+ int samples, total_samples;
int ret;
- int16_t *output;
if(!avpkt->size){
//FIXME flush
@@ -174,8 +156,6 @@ static int oggvorbis_decode_frame(AVCodecContext
*avccontext, AVFrame *frame,
frame->nb_samples = 8192*4;
if ((ret = ff_get_buffer(avccontext, frame, 0)) < 0)
return ret;
- output = (int16_t *)frame->data[0];
-
op->packet = avpkt->data;
op->bytes = avpkt->size;
@@ -190,11 +170,10 @@ static int oggvorbis_decode_frame(AVCodecContext
*avccontext, AVFrame *frame,
vorbis_synthesis_blockin(&context->vd, &context->vb) ;
total_samples = 0 ;
- total_bytes = 0 ;
while((samples = vorbis_synthesis_pcmout(&context->vd, &pcm)) > 0) {
- conv(samples, pcm, (char*)output + total_bytes, context->vi.channels) ;
- total_bytes += samples * 2 * context->vi.channels ;
+ for (int ch = 0; ch < context->vi.channels; ch++)
+ memcpy((float *)frame->extended_data[ch] + total_samples, pcm[ch],
samples * sizeof(float));
total_samples += samples ;
vorbis_synthesis_read(&context->vd, samples) ;
}
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]