diff mbox series

[FFmpeg-devel,1/5] avformat/mov_chan: do not assume channels are in native order

Message ID 20240129232755.9622-1-cus@passwd.hu
State Accepted
Commit 3d3cad7483785191b99557c78d5a4a551088c549
Headers show
Series [FFmpeg-devel,1/5] avformat/mov_chan: do not assume channels are in native order | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint Jan. 29, 2024, 11:27 p.m. UTC
Existing code could have caused wrong channel order signalling or reduced
channel count if a channel designation appeared multiple times. This is
actually an old bug, but the conversion to the new channel layout API made it
visible, because now the code overrides the proper channel count with the one
calculated from the mask.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mov_chan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marton Balint Feb. 8, 2024, 7:25 p.m. UTC | #1
On Tue, 30 Jan 2024, Marton Balint wrote:

> Existing code could have caused wrong channel order signalling or reduced
> channel count if a channel designation appeared multiple times. This is
> actually an old bug, but the conversion to the new channel layout API made it
> visible, because now the code overrides the proper channel count with the one
> calculated from the mask.

Will apply and backport patches 1 and 2.

For the new API, I will wait a bit more.

Regards,
Marton

>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/mov_chan.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
> index f3d51899e1..5cb2de3820 100644
> --- a/libavformat/mov_chan.c
> +++ b/libavformat/mov_chan.c
> @@ -530,7 +530,7 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
>         size -= 20;
>         if (layout_tag == 0) {
>             uint64_t mask_incr = mov_get_channel_mask(label);
> -            if (mask_incr == 0) {
> +            if (mask_incr == 0 || mask_incr <= label_mask) {
>                 label_mask = 0;
>                 break;
>             }
> -- 
> 2.35.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
index f3d51899e1..5cb2de3820 100644
--- a/libavformat/mov_chan.c
+++ b/libavformat/mov_chan.c
@@ -530,7 +530,7 @@  int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st,
         size -= 20;
         if (layout_tag == 0) {
             uint64_t mask_incr = mov_get_channel_mask(label);
-            if (mask_incr == 0) {
+            if (mask_incr == 0 || mask_incr <= label_mask) {
                 label_mask = 0;
                 break;
             }