dvdauthor segfaults on non-existing xml file

Bug #425702 reported by Andreas F
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
dvdauthor (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

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 <email address hidden>

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 <email address hidden>

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

Revision history for this message
Stefano Rivera (stefanor) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. However, I am closing it because the bug has been fixed in the latest development version of Ubuntu - Maverick Meerkat.

If you need a fix for the bug in previous versions of Ubuntu, please follow the instructions for "How to request new packages" at https://help.ubuntu.com/community/UbuntuBackports#request-new-packages

Changed in dvdauthor (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.