bugCompact Disc Input and Control Library - Bugs: bug #15787, cd-info for Mac OS X 10.4 always...

 
 

bug #15787: cd-info for Mac OS X 10.4 always reports wrong track number with any AudioCD.

Submitter:  None
Submitted:  Sat 18 Feb 2006 05:59:16 AM UTC
   
 
Category:  run-time error Severity:  5 - Average
Item Group:  libcdio Status:  Fixed
Privacy:  Public Assigned to:  rocky
Originator Email:  -email is unavailable- Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 21 Feb 2006 03:58:37 PM UTC, comment #7: 

osx.c around line 94 does have the "lead-out" track number set 162(0xA2).

It's possible that one might want to store some of the other non-track information (0xA0, 0xA1). And get_track_format_osx() might be either non-optimal or worse wrong in some cases. However as I don't have access to an OSX computer with an attached drive, it is difficult for me to do such experiments. 

Instead, I welcome others who are interested to investigate and by all means send patches. The idea of open source is that everyone who is able can contribute. In fact if you want OSX support improved, this is probably the best way to ensure it gets done.

(Sorry about the verbatim unmodified quote in comment #6. My navigation/editing expertice of Tracker has a bit to be desired.)

Rocky Bernstein <rocky>
Group administrator
Mon 20 Feb 2006 03:36:35 AM UTC, comment #6: 

hi, Rocky.

The "lead-out" track number on Mac OS X is 162(0xA2).

> --DEBUG: point: 162, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 48:50:11


The track number 170(0xAA) is not found in CDTOC structure of Mac OS X.

BTW, I found the following text.

>The CDTOC structure is same as what is returned by a READ TOC command, format 0x02.


URL: http://developer.apple.com/documentation/Darwin/Reference/IOKit/IOCDMedia/CompositePage.html

I think that "format 0x02" might be different from general TOC information.

Anonymous
Sat 18 Feb 2006 10:52:41 PM UTC, comment #5: 

Thanks for following up on this, investigating and reporting the information you found. Changes in CVS have been made so we no longer access outside of the valid range of pTrackDescriptors[] as you suggest. It will be part of the next release.

(Of course you may want to verify that what I claim is correct.)

Rocky Bernstein <rocky>
Group administrator
Sat 18 Feb 2006 09:45:25 PM UTC, comment #4: 

hi, Rocky.

p_env->i_descriptors come from below line in lib/driver/osx.c .

  p_env->i_descriptors = CDTOCGetDescriptorCount ( p_env->pTOC );

The value that CDTOCGetDescriptorCount() returns is not the total number of tracks in Audio CD.
CDTOCGetDescriptorCount() returns the total number of tracks + 3. ( I have not seen other cases. )
Please see below debug log. This is not the worst case. In the worst case, the Segmantaiton Fault will occurs.

--DEBUG: point: 160, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 1:0:0
--DEBUG: point: 161, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 4:0:0
--DEBUG: point: 162, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 48:50:11
--DEBUG: point: 1, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 0:2:0
--DEBUG: point: 2, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 7:50:42
--DEBUG: point: 3, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 27:6:56
--DEBUG: point: 4, tno: 0, session: 1, adr: 1, control:0, address: 0:0:0, p: 47:9:5
--DEBUG: point: 0, tno: 0, session: 0, adr: 0, control:0, address: 0:0:0, p: 255:255:255

This Audio CD has 4 tracks, and The value that CDTOCGetDescriptorCount() returns is 7.
The last line is pTrackDescriptors[7]. this line is random per execute.
Please do not access pTrackDescriptors[p_env->i_descriptors] because the number of elements in pTrackDescriptors[] array is p_env->i_descriptors, not (p_env->i_descriptors + 1).

Sample Code is here.
http://www.opensource.apple.com/darwinsource/10.3.4/IOSCSIArchitectureModelFamily-135.3.2/TestTools/Optical/CDTOC/CDTOC.c

---
demo-n

Anonymous
Sat 18 Feb 2006 07:41:38 PM UTC, comment #3: 

Ooops. Caught by my own change. Should be fixed now in CVS. Yes, it's cdio_mmc_direction_t to use.
          ^^^^

Thanks for looking at.

Rocky Bernstein <rocky>
Group administrator
Sat 18 Feb 2006 07:13:32 PM UTC, comment #2: 

hi, Rocky

I am checking now. but current CVS version can not built on Mac OS X .
osx.c:353: error: parse error before 'mmc_direction_t'

I should use cdio_direction_t instead of scsi_direction_t?
the change of include/cdio/mmc.h causes this issue, I guess.

---
demo-n

Anonymous
Sat 18 Feb 2006 01:25:25 PM UTC, comment #1: 

Thanks for reporting the bug.

Part of the complication I think comes from the fact that we need to get "lead-out" track information (i.e. find out the end of the CD) and probably that too may be stored in the pTrackDescriptors array. If not, where else would it be?

You report that the total number of tracks reported is one too large. But that is calculated as last_track - first_track + 1. So is it the last_track or the first_track that's wrong? Is this only on audio CD's or other kinds of CD's (data, VCD) as well?

Rocky Bernstein <rocky>
Group administrator
Sat 18 Feb 2006 05:59:16 AM UTC, original submission:  

cd-info for Mac OS X 10.4 always reports wrong track number with any AudioCD.

The root cause is read_toc_osx() in lib/driver/osx.c, I guess.
In read_toc_osx()
    for( i = 0; i <= p_env->i_descriptors; i++ )
is wrong.
    for( i = 0; i < p_env->i_descriptors; i++ )
works correctly because the number of elements in pTrackDescriptors[] array is p_env->i_descriptors, not (p_env->i_descriptors + 1)

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-02-18 rocky StatusNeed Info Fixed
    Assigned toNone rocky
    Open/ClosedOpen Closed
2006-02-18 rocky StatusNone Need Info

Back to the top

Powered by Savane 3.12.
Corresponding source code