Bug 216571 - audacious creates bad CDDB query strings
Summary: audacious creates bad CDDB query strings
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: audacious
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Ralf Ertzinger
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-21 05:23 UTC by Richard Chan
Modified: 2008-08-02 23:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-02-18 17:18:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Richard Chan 2006-11-21 05:23:17 UTC
Description of problem:

Audacious creates bad CDDB query strings to the server due to an interaction
between sprintf and FORTIFY_SOURCE in gcc/glibc.

CDDB query command string includes an offsets string that looks like
150+22924+36379+186648 (depending on the number of tracks)

Audacious is truncating this to +186648 (i.e. only the last offset)

This due to the use of the construct
...sprintf(buffer, "%s+%d", buffer, ....) in Plugins/Input/cdaudio/cddb.c
and gcc -D_FORTIFY_SOURCE=2. In-place reuse of buffer doesn't work in
this case., i.e. suppose buffer is "150" and the intention is to
extend it to "150+22924" - with the use of FORTIFY_SOURCE it becomes
"+22924" only.


Version-Release number of selected component (if applicable):
1.1.2-4.fc6.src,rpm

How reproducible:
Always

Steps to Reproduce:
1.Insert CD-Audio
2.Enable CDDB lookup
3. Enable Network Window
  
Actual results:
Server will reply with 500: Invalid command syntax


Expected results:
Server will reply with CD information


Additional info:

Comment 1 Richard Chan 2006-11-21 08:02:35 UTC
I've learnt from the gcc maintainer that it is undefined behaviour for sprintf to 
reuse the same buffer. This is a bug in upstream. 

Comment 2 Ralf Ertzinger 2006-11-21 09:26:29 UTC
The bug is still valid, since audacious does produce invalid strings.
I'll incorporate your patch in the upcoming 1.2.x release.

Comment 3 Richard Chan 2006-11-22 01:58:37 UTC
The reference for the gcc bug is 215690 where the maintainer explains
the undefined use of sprintf.

Comment 4 Ralf Ertzinger 2006-12-04 11:15:09 UTC
This should be fixed in 1.2.2, released for FC-6


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