mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
Fix for WAV file with off LIST chunks.
This commit is contained in:
parent
cf43fb1528
commit
d343bda014
@ -3,6 +3,10 @@
|
||||
* src/ircam.c
|
||||
Fix writing of IRCAM files (thanks to Axel Röbel).
|
||||
|
||||
* src/wav.c
|
||||
Add workaround for files created by the Peak audio editor on Mac which can
|
||||
produce files with very short LIST chunks.
|
||||
|
||||
2005-04-30 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/aiff.c
|
||||
|
@ -370,6 +370,7 @@ enum
|
||||
SFE_WAV_BAD_FORMAT,
|
||||
SFE_WAV_BAD_BLOCKALIGN,
|
||||
SFE_WAV_NO_DATA,
|
||||
SFE_WAV_BAD_LIST,
|
||||
SFE_WAV_ADPCM_NOT4BIT,
|
||||
SFE_WAV_ADPCM_CHANNELS,
|
||||
SFE_WAV_GSM610_FORMAT,
|
||||
|
@ -109,6 +109,7 @@ ErrorStruct SndfileErrors [] =
|
||||
{ SFE_WAV_BAD_FORMAT , "Error in WAV file. Errors in 'fmt ' chunk." },
|
||||
{ SFE_WAV_BAD_BLOCKALIGN , "Error in WAV file. Block alignment in 'fmt ' chunk is incorrect." },
|
||||
{ SFE_WAV_NO_DATA , "Error in WAV file. No 'data' chunk marker." },
|
||||
{ SFE_WAV_BAD_LIST , "Error in WAV file. Malformed LIST chunk." },
|
||||
{ SFE_WAV_UNKNOWN_CHUNK , "Error in WAV file. File contains an unknown chunk marker." },
|
||||
{ SFE_WAV_WVPK_DATA , "Error in WAV file. Data is in WAVPACK format." },
|
||||
|
||||
|
10
src/wav.c
10
src/wav.c
@ -1110,14 +1110,20 @@ wav_subchunk_parse (SF_PRIVATE *psf, int chunk)
|
||||
|
||||
bytesread = psf_binheader_readf (psf, "e4", &length) ;
|
||||
|
||||
if (current_pos + length > psf->filelength)
|
||||
if (length <= 8)
|
||||
{ /* This case is for broken files generated by PEAK. */
|
||||
psf_log_printf (psf, "%M : %d (weird length)\n", chunk, length) ;
|
||||
psf_binheader_readf (psf, "mj", &chunk, length - 4) ;
|
||||
psf_log_printf (psf, " %M\n", chunk) ;
|
||||
return 0 ;
|
||||
}
|
||||
else if (current_pos + length > psf->filelength)
|
||||
{ psf_log_printf (psf, "%M : %d (should be %d)\n", chunk, length, (int) (psf->filelength - current_pos)) ;
|
||||
length = psf->filelength - current_pos ;
|
||||
}
|
||||
else
|
||||
psf_log_printf (psf, "%M : %d\n", chunk, length) ;
|
||||
|
||||
|
||||
while (bytesread < length)
|
||||
{ bytesread += psf_binheader_readf (psf, "m", &chunk) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user