summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-22 22:13:13 +0200
committerwm4 <wm4@nowhere>2015-08-22 22:13:20 +0200
commit5c3196d20bdacf32f922fef27de3d34e2549af07 (patch)
treee4aa05445481a121921b982c0e625bf65eb37844 /stream
parent602105dbdae5b35dfcd7c060349b42a990bd25a8 (diff)
downloadmpv-5c3196d20bdacf32f922fef27de3d34e2549af07.tar.bz2
mpv-5c3196d20bdacf32f922fef27de3d34e2549af07.tar.xz
stream_libarchive: read tar only in "unsafe" mode
As expected, probing with libarchive is a disaster. Both libavformat and libarchive are too eager to misdetect file formats just because files "might" be of a specific type. In this case, it's mp3 vs. tar. To be fair, neither file format has an actual header. I'm not sure why we'd need tar support, but since libarchive provides it, and idiots on the internet apparently pack media files in tar sometimes (really, idiots), keep it for now, and probe tar last.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_libarchive.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c
index 307450c81b..116488d551 100644
--- a/stream/stream_libarchive.c
+++ b/stream/stream_libarchive.c
@@ -81,14 +81,16 @@ struct mp_archive *mp_archive_new(struct mp_log *log, struct stream *src,
goto err;
archive_read_support_format_7zip(mpa->arch);
- archive_read_support_format_gnutar(mpa->arch);
- archive_read_support_format_tar(mpa->arch);
archive_read_support_format_iso9660(mpa->arch);
archive_read_support_format_rar(mpa->arch);
archive_read_support_format_zip(mpa->arch);
archive_read_support_filter_bzip2(mpa->arch);
archive_read_support_filter_gzip(mpa->arch);
archive_read_support_filter_xz(mpa->arch);
+ if (flags & MP_ARCHIVE_FLAG_UNSAFE) {
+ archive_read_support_format_gnutar(mpa->arch);
+ archive_read_support_format_tar(mpa->arch);
+ }
archive_read_set_callback_data(mpa->arch, mpa);
archive_read_set_read_callback(mpa->arch, read_cb);