Commit 47ed4708e2 for ffmpeg
commit 47ed4708e2f2902d335e1514726f3cba370bbd53
Author: StressTestor <212606152+StressTestor@users.noreply.github.com>
Date: Sun Oct 11 22:26:31 2026 -0600
avformat/wtvdec: fail on a short read of a legacy attribute GUID
get_tag() reads a 16-byte GUID attribute into a stack buffer with
avio_read() and ignores the return value. On a legacy_attrib entry
that is cut inside the GUID, the 16 bytes are never written and the
uninitialised stack contents are formatted with PRI_PRETTY_GUID and
published as a metadata string; ffprobe prints them as e.g.
"TAG:encoder=aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaaaaaa" on a build with
-ftrivial-auto-var-init=pattern.
Use ff_get_guid(), which reads with ffio_read_size() and fails on a
short read, and return without adding the tag, as get_tag() already
does when a string attribute is empty.
Same class as c2394a0ff3 (binka), 29f513af78 (fsb), 4b47405e1c (genh).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: StressTestor <212606152+StressTestor@users.noreply.github.com>
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index adea4d9d39..e11b00937d 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -496,7 +496,8 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty
snprintf(buf, sizeof(buf), "%u", avio_rl16(pb));
} else if (type == 6 && length == 16) {
ff_asf_guid guid;
- avio_read(pb, guid, 16);
+ if (ff_get_guid(pb, &guid) < 0)
+ return;
snprintf(buf, sizeof(buf), PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid));
} else if (type == 2 && !strcmp(key, "WM/Picture")) {
get_attachment(s, pb, length);