Commit e7696934fc for ffmpeg
commit e7696934fc1a8422e8f4e4918b5ec97f360b6a5a
Author: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Date: Fri Nov 13 21:25:03 2026 -0800
avformat/movenc: omit unrepresentable 3GP album track numbers
TS 26.244 TrackNumber is an optional 8-bit field;
skip it when the track does not fit.
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index da1a44d757..7e510a63b1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5177,8 +5177,13 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
avio_wb16(pb, language_code("eng")); /* language */
avio_write(pb, t->value, strlen(t->value) + 1); /* UTF8 string value */
if (!strcmp(tag, "albm") &&
- (t = av_dict_get(s->metadata, "track", NULL, 0)))
- avio_w8(pb, atoi(t->value));
+ (t = av_dict_get(s->metadata, "track", NULL, 0))) {
+ char *end;
+ long track = strtol(t->value, &end, 10);
+ if (end != t->value && (!*end || *end == '/') &&
+ track >= 0 && track <= UINT8_MAX)
+ avio_w8(pb, track);
+ }
}
return update_size(pb, pos);
}