summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-17 20:57:04 +0000
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-17 20:57:04 +0000
commit8a5c8d14f4a9788d256dd3d727ec107a6e3c0220 (patch)
tree45bd05c5989161e78b9f07b0a1a14993a8a7c223 /src
parentfa60bd19a16595b147477d49215f2aefde5b0d5b (diff)
downloadxine-lib-8a5c8d14f4a9788d256dd3d727ec107a6e3c0220.tar.gz
xine-lib-8a5c8d14f4a9788d256dd3d727ec107a6e3c0220.tar.bz2
Use memcmp to check for the WAV signature; use xine_xmalloc rather than simply malloc.
CVS patchset: 8708 CVS date: 2007/03/17 20:57:04
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_wav.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 145212eda..1e46d8526 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -22,7 +22,7 @@
* MS WAV File Demuxer by Mike Melanson (melanson@pcisys.net)
* based on WAV specs that are available far and wide
*
- * $Id: demux_wav.c,v 1.64 2007/01/19 00:26:40 dgp85 Exp $
+ * $Id: demux_wav.c,v 1.65 2007/03/17 20:57:04 dgp85 Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -86,18 +86,7 @@ static int open_wav_file(demux_wav_t *this) {
if (_x_demux_read_header(this->input, signature, WAV_SIGNATURE_SIZE) != WAV_SIGNATURE_SIZE)
return 0;
- if ((signature[0] != 'R') ||
- (signature[1] != 'I') ||
- (signature[2] != 'F') ||
- (signature[3] != 'F') ||
- (signature[8] != 'W') ||
- (signature[9] != 'A') ||
- (signature[10] != 'V') ||
- (signature[11] != 'E') ||
- (signature[12] != 'f') ||
- (signature[13] != 'm') ||
- (signature[14] != 't') ||
- (signature[15] != ' '))
+ if (memcmp(signature, "RIFF", 4) || memcmp(&signature[8], "WAVEfmt ", 8) )
return 0;
/* file is qualified; skip over the header bytes in the stream */
@@ -108,7 +97,7 @@ static int open_wav_file(demux_wav_t *this) {
(unsigned char *)&this->wave_size, 4) != 4)
return 0;
this->wave_size = le2me_32(this->wave_size);
- this->wave = (xine_waveformatex *) malloc( this->wave_size );
+ this->wave = xine_xmalloc( this->wave_size );
if (this->input->read(this->input, (void *)this->wave, this->wave_size) !=
this->wave_size) {