This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 62c308e0416bb701447817fe6f0bff074d206215
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Oct 31 05:17:55 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Thu Nov 5 23:01:14 2026 +0000

    avcodec/hap: bound the sum of the uncompressed chunk sizes
    
    Fixes: out of array write
    Fixes: fglxAK3pz5sP
    Fixes: AISLE-2026-0150-00462
    Out of array write Replicated through UnModified FFmpeg (32-bit) with ASAN
    
    Found-by: Joshua Rogers (AISLE)
---
 libavcodec/hapdec.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index 70bf592f2a..7b35058467 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -187,6 +187,7 @@ static int hap_parse_frame_header(AVCodecContext *avctx)
     ctx->tex_size = 0;
     for (i = 0; i < ctx->chunk_count; i++) {
         HapChunk *chunk = &ctx->chunks[i];
+        int64_t uncompressed_size;
 
         /* Check the compressed buffer is valid */
         if (chunk->compressed_offset + (uint64_t)chunk->compressed_size > 
bytestream2_get_bytes_left(gbc))
@@ -199,20 +200,21 @@ static int hap_parse_frame_header(AVCodecContext *avctx)
         /* Fill out uncompressed size */
         if (chunk->compressor == HAP_COMP_SNAPPY) {
             GetByteContext gbc_tmp;
-            int64_t uncompressed_size;
             bytestream2_init(&gbc_tmp, gbc->buffer + chunk->compressed_offset,
                              chunk->compressed_size);
             uncompressed_size = ff_snappy_peek_uncompressed_length(&gbc_tmp);
             if (uncompressed_size < 0) {
                 return uncompressed_size;
             }
-            chunk->uncompressed_size = uncompressed_size;
         } else if (chunk->compressor == HAP_COMP_NONE) {
-            chunk->uncompressed_size = chunk->compressed_size;
+            uncompressed_size = chunk->compressed_size;
         } else {
             return AVERROR_INVALIDDATA;
         }
-        ctx->tex_size += chunk->uncompressed_size;
+        if (uncompressed_size > INT_MAX - ctx->tex_size)
+            return AVERROR_INVALIDDATA;
+        chunk->uncompressed_size = uncompressed_size;
+        ctx->tex_size += uncompressed_size;
     }
 
     av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to