PR #25627 opened by Peter Ross (pross)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25627
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25627.patch

Use dedicated variable for signalling an unaligned chunk.  When an APPL
chunk is encountered, size is modified, so the size variable cannot be
later used as a reliable unaligned indicator.

Suggested-by: Kae
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25617

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 2b766f41f33a59d524cd119ee3f07e9878e3f680 Mon Sep 17 00:00:00 2001
From: Peter Ross <[email protected]>
Date: Sat, 31 Oct 2026 07:23:49 +1100
Subject: [PATCH] avformat/aiffdec: improved handling of unaligned chunks

Use dedicated variable for signalling an unaligned chunk.  When an APPL
chunk is encountered, size is modified, so the size variable cannot be
later used as a reliable unaligned indicator.

Suggested-by: Kae
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25617
---
 libavformat/aiffdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 63194f27263..2a14d0b95cc 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -265,6 +265,7 @@ static int aiff_read_header(AVFormatContext *s)
         if (size < 0)
             return size;
 
+        const int padding = size & 1;
         filesize -= size + 8;
 
         switch (tag) {
@@ -394,7 +395,7 @@ static int aiff_read_header(AVFormatContext *s)
         }
 
         /* Skip required padding byte for odd-sized chunks. */
-        if (size & 1) {
+        if (padding) {
             filesize--;
             avio_skip(pb, 1);
         }
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to