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.
This commit is contained in:
wm4 2015-08-22 22:13:13 +02:00
parent 602105dbda
commit 5c3196d20b
1 changed files with 4 additions and 2 deletions

View File

@ -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);