Bug 127658 - xcdroast segfaults parsing cdda2wav output
Summary: xcdroast segfaults parsing cdda2wav output
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: xcdroast
Version: 2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-07-12 10:03 UTC by Tim Waugh
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-07-13 13:52:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
xcdroast-linebuffer.patch (772 bytes, patch)
2004-07-12 11:30 UTC, Tim Waugh
no flags Details | Diff

Description Tim Waugh 2004-07-12 10:03:57 UTC
Description of problem:
Due to the way that xcdroast parses output from cdda2wav, it may
segfault while reading the table of contents of a CD.

Version-Release number of selected component (if applicable):
xcdroast-0.98a15-2
cdda2wav-2.01-0.a27.4.FC2.1

How reproducible:
From time to time in normal usage.  Can be forced.

The problem is that xcdroast expects to read() entire lines from
cdda2wav's output file descriptor, but that isn't how it write()s:

write(2, "T22:", 4)                     = 4
write(2, "  340375", 8)                 = 8
write(2, "  3:01.32", 9)                = 9
write(2, " audio pre-emphasized copydenied stereo", 39) = 39

So there is a race condition where cdda2wav may have started writing a
line but not finished, and xcdroast has begun to parse it.

(gdb) bt
#0  0x08089d36 in parse_toc_line (line=0xfee5ab00 "T22:  340375  3:01.32")
    at io.c:2686
#1  0x0808a880 in parse_toc (line=0xfee5ab00 "T22:  340375  3:01.32")
    at io.c:2930
#2  0x0808aa0f in getcdtoc_out (data=0x0, source=135150288,
    cond=GDK_INPUT_READ) at io.c:2979
#3  0x0013bb3b in gdk_get_show_events () from /usr/lib/libgdk-x11-2.0.so.0
#4  0x00000000 in ?? ()

Here, xcdroast requires 'data' or 'audio' following the track length,
but cdda2wav didn't write that out before xcdroast read the line.

Comment 1 Tim Waugh 2004-07-12 11:30:36 UTC
Created attachment 101806 [details]
xcdroast-linebuffer.patch

This patch works around the problem for me.


Note You need to log in before you can comment on or make changes to this bug.