mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 08:33:36 +02:00
Fix Bug 504 (P2) - PPC Macs crash importing MP3 files with "guess_file_type" error
in id3.c: psf->fileoffset is a sf_count_t, which is int64_t, which is larger than size_t on a G4 PPC. Since psf_binheader_readf expects that argument to be the smaller size_t, it ends up seeking over and over to the zero position since the larger bits of the variable are all zeros. Patch simply casts to size_t. Patch sent upstream as well.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
Index: libsndfile/src/id3.c
|
||||
===================================================================
|
||||
--- libsndfile/src/id3.c (revision 11748)
|
||||
+++ libsndfile/src/id3.c (working copy)
|
||||
@@ -32,7 +32,7 @@
|
||||
{ unsigned char buf [10] ;
|
||||
|
||||
memset (buf, 0, sizeof (buf)) ;
|
||||
- psf_binheader_readf (psf, "pb", 0, buf, 10) ;
|
||||
+ psf_binheader_readf (psf, "pb", (size_t)0, buf, 10) ;
|
||||
|
||||
if (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')
|
||||
{ int offset = buf [6] & 0x7f ;
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
/* Calculate new file offset and position ourselves there. */
|
||||
psf->fileoffset += offset + 10 ;
|
||||
- psf_binheader_readf (psf, "p", psf->fileoffset) ;
|
||||
+ psf_binheader_readf (psf, "p", (size_t)psf->fileoffset) ;
|
||||
|
||||
return 1 ;
|
||||
} ;
|
@@ -32,7 +32,7 @@ id3_skip (SF_PRIVATE * psf)
|
||||
{ unsigned char buf [10] ;
|
||||
|
||||
memset (buf, 0, sizeof (buf)) ;
|
||||
psf_binheader_readf (psf, "pb", 0, buf, 10) ;
|
||||
psf_binheader_readf (psf, "pb", (size_t)0, buf, 10) ;
|
||||
|
||||
if (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')
|
||||
{ int offset = buf [6] & 0x7f ;
|
||||
@@ -48,7 +48,7 @@ id3_skip (SF_PRIVATE * psf)
|
||||
|
||||
/* Calculate new file offset and position ourselves there. */
|
||||
psf->fileoffset += offset + 10 ;
|
||||
psf_binheader_readf (psf, "p", psf->fileoffset) ;
|
||||
psf_binheader_readf (psf, "p", (size_t)psf->fileoffset) ;
|
||||
|
||||
return 1 ;
|
||||
} ;
|
||||
|
Reference in New Issue
Block a user