Hey,

thanks. I've fixed this by testing if the file exists before asking
libmagic for the MIME type.

The attached patch works against v1.8.0 which I've released yesterday
but should also apply against 1.7.0 (well, maybe not the ChangeLog part,
but the hunk for mkvmerge.cpp should).

Regards,
Mosu

-- 
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3363)
+++ ChangeLog	(revision 3364)
@@ -1,5 +1,9 @@
 2006-11-12  Moritz Bunkus  <[EMAIL PROTECTED]>
 
+	* 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.
 
Index: src/merge/mkvmerge.cpp
===================================================================
--- src/merge/mkvmerge.cpp	(revision 3363)
+++ src/merge/mkvmerge.cpp	(revision 3364)
@@ -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);

Attachment: pgpNpk3BmTChU.pgp
Description: PGP signature

Reply via email to