Bug 127658 - xcdroast segfaults parsing cdda2wav output
xcdroast segfaults parsing cdda2wav output
Product: Fedora
Classification: Fedora
Component: xcdroast (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Depends On:
  Show dependency treegraph
Reported: 2004-07-12 06:03 EDT by Tim Waugh
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-07-13 09:52:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Tim Waugh 2004-07-12 06:03:57 EDT
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):

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 07:30:36 EDT
Created attachment 101806 [details]

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.