mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-01 15:56:59 +00:00
--attach-file: Test if the file can be read before trying to guess its MIME type because libmagic segfaults if it does not.
This commit is contained in:
parent
f792d7fb66
commit
f84a88952e
@ -1,5 +1,9 @@
|
||||
2006-11-12 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* mkvmerge: bug fix: Fixed a segfault if the file specified with
|
||||
"--attach-file" does not exist. Bugfix for Anthill bug 213 and
|
||||
Debian bug 393984.
|
||||
|
||||
* mmg: bug fix: Fixed a crash on loading XML chapters after having
|
||||
saved XML chapters.
|
||||
|
||||
|
@ -1610,6 +1610,14 @@ parse_args(vector<string> args) {
|
||||
if (no_next_arg)
|
||||
mxerror(_("'%s' lacks the file name.\n"), this_arg.c_str());
|
||||
|
||||
try {
|
||||
mm_file_io_c test(next_arg);
|
||||
} catch (...) {
|
||||
mxerror(_("The file '%s' cannot be attached because "
|
||||
"it does not exist or cannot be read.\n"),
|
||||
next_arg.c_str());
|
||||
}
|
||||
|
||||
attachment.name = next_arg;
|
||||
if (attachment.mime_type == "")
|
||||
attachment.mime_type = guess_mime_type_and_report(next_arg);
|
||||
|
Loading…
Reference in New Issue
Block a user