summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-04-01 14:34:04 +0300
committerMartin Storsjö <martin@martin.st>2021-07-15 10:25:39 +0300
commit13ec6624b3507052d8a0e14cee39b49e3c99450f (patch)
treef66cc82fdac53a5c0f034945b9f7d9aa287cc95c /libavformat/mov.c
parenta99dd5f6a4cf263bdbbb18f6b665f3399995ab26 (diff)
mov: Don't export unknown/unhandled metadata types as if they were UTF8
They can be other incompatible text encodings (such as UTF-16), or even binary data. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 329bf3b207..a37a9cc917 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -501,6 +501,14 @@ retry:
av_free(str);
return AVERROR_INVALIDDATA;
}
+ } else if (data_type > 1 && data_type != 4) {
+ // data_type can be 0 if not set at all above. data_type 1 means
+ // UTF8 and 4 means "UTF8 sort". For any other type (UTF16 or e.g.
+ // a picture), don't return it blindly in a string that is supposed
+ // to be UTF8 text.
+ av_log(c->fc, AV_LOG_WARNING, "Skipping unhandled metadata %s of type %d\n", key, data_type);
+ av_free(str);
+ return 0;
} else {
int ret = ffio_read_size(pb, str, str_size);
if (ret < 0) {