[Bug 425702] [NEW] dvdauthor segfaults on non-existing xml file

Andreas F andreas at faafeng.com
Mon Sep 7 13:07:46 UTC 2009


Public bug reported:

dvdauthor segfaults if the file given with the "-x" option does not
exist.  This particular bug has been reported on the dvdauthor mailing
list over a year ago [1], but the maintainer has been unresponsive [2].
The bug is rooted in not checking the return value from varied_open()
after opening a file in readxml.c

Note that there are currently (at least) two forks of the dvdauthor
project [2].

Version: dvdauthor-0.6.14 (dvdauthor_0.6.14-3ubuntu3)

Platforms: Tested and confirmed on both 9.04 and 9.10.

How to reproduce (there is no file 'foo' on local file system):

$ ./src/dvdauthor -x foo
DVDAuthor::dvdauthor, version 0.6.14.
Build options: gnugetopt iconv
Send bugs to <dvdauthor-users at lists.sourceforge.net>

Segmentation fault (core dumped)

Fix:
$ git diff src/readxml.c
diff --git a/src/readxml.c b/src/readxml.c
index e96f869..fe2395a 100644
--- a/src/readxml.c
+++ b/src/readxml.c
@@ -57,6 +57,10 @@ int readxml(const char *xmlfile,struct elemdesc *elems,struct elemattr *attrs)
     struct vfile fd;
 
     fd=varied_open(xmlfile,O_RDONLY);
+    if( !fd.h ) {
+        fprintf(stderr,"ERR:  No such file '%s'\n",xmlfile);
+        exit(1);
+    }
     f=xmlReaderForIO(xml_varied_read,xml_varied_close,&fd,xmlfile,NULL,0);
     if(!f) {
         fprintf(stderr,"ERR:  Unable to open XML file %s\n",xmlfile);

Behaviour after fix:

$ ./src/dvdauthor -x foo
DVDAuthor::dvdauthor, version 0.6.14.
Build options: gnugetopt iconv
Send bugs to <dvdauthor-users at lists.sourceforge.net>

ERR:  No such file 'foo'

See also:

[1] http://sourceforge.net/mailarchive/message.php?msg_name=78jvum%241d4grh%40smtp.mailfilter6.ihug.co.nz
[2] https://answers.launchpad.net/ubuntu/+source/dvdauthor/+question/81868

** Affects: dvdauthor (Ubuntu)
     Importance: Undecided
         Status: New

-- 
dvdauthor segfaults on non-existing xml file
https://bugs.launchpad.net/bugs/425702
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list