Commit 0f5ebb1eb6 for ffmpeg
commit 0f5ebb1eb6b37739d820f13d5d9400edb8466a90
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Oct 12 02:15:55 2026 +0200
avfilter/af_sofalizer: reject SOFA files with an IR length of 0
Fixes: undefined clz of 0
Fixes: jj9j0M05l3SP
Regression since: 7ea4b928a2
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24624
Undefined clz of 0 Replicated through UnModified FFmpeg with UBSAN
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index 01278c2d42..e1670d08e7 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -153,6 +153,11 @@ static int preload_sofa(AVFilterContext *ctx, char *filename, int *samplingrate)
return ret;
}
+ if (!mysofa->N) {
+ av_log(ctx, AV_LOG_ERROR, "Selected SOFA file has inconsistent dimensions.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (s->normalize)
mysofa_loudness(s->sofa.hrtf);