File ffmpeg-CVE-2025-7700.patch of Package ffmpeg.39878

Index: ffmpeg-3.4.2/libavcodec/alsdec.c
===================================================================
--- ffmpeg-3.4.2.orig/libavcodec/alsdec.c
+++ ffmpeg-3.4.2/libavcodec/alsdec.c
@@ -2075,8 +2075,8 @@ static av_cold int decode_init(AVCodecCo
         ctx->nbits  = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits));
         ctx->mlz    = av_mallocz(sizeof(*ctx->mlz));
 
-        if (!ctx->mlz || !ctx->acf || !ctx->shift_value || !ctx->last_shift_value
-            || !ctx->last_acf_mantissa || !ctx->raw_mantissa) {
+        if (!ctx->larray || !ctx->nbits || !ctx->mlz || !ctx->acf || !ctx->shift_value
+            || !ctx->last_shift_value || !ctx->last_acf_mantissa || !ctx->raw_mantissa) {
             av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
             ret = AVERROR(ENOMEM);
             goto fail;
@@ -2087,6 +2087,10 @@ static av_cold int decode_init(AVCodecCo
 
         for (c = 0; c < avctx->channels; ++c) {
             ctx->raw_mantissa[c] = av_mallocz_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa));
+            if (!ctx->raw_mantissa[c]) {
+                av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
+                ret = AVERROR(ENOMEM);
+                goto fail;
         }
     }
 
openSUSE Build Service is sponsored by