summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Jager <t.jager@gmx.de>2013-12-30 15:38:40 +0100
committerTorsten Jager <t.jager@gmx.de>2013-12-30 15:38:40 +0100
commit975227b219510111012f1ec51ce6d053fb57f17b (patch)
tree606c8be03d9418090f8b7d4b8d174482142a995c
parent6cd47d3b445a4b56c9e16c722e6fca4fc3b12b74 (diff)
downloadxine-lib-975227b219510111012f1ec51ce6d053fb57f17b.tar.gz
xine-lib-975227b219510111012f1ec51ce6d053fb57f17b.tar.bz2
Dont freeze on some wav files.
That is, when "data" does not immediately follow "fmt ".
-rw-r--r--src/demuxers/demux_ac3.c3
-rw-r--r--src/demuxers/demux_dts.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c
index b84617499..51922bedc 100644
--- a/src/demuxers/demux_ac3.c
+++ b/src/demuxers/demux_ac3.c
@@ -164,6 +164,7 @@ static int open_ac3_file(demux_ac3_t *this) {
/* Check for wav header, as we'll handle AC3 with a wav header shoved
* on the front for CD burning */
+ /* FIXME: This is risky. Real LPCM may contain anything, even sync words. */
if ( memcmp(peak, "RIFF", 4) == 0 || memcmp(&peak[8], "WAVEfmt ", 8) == 0 ) {
/* Check this looks like a cd audio wav */
unsigned int audio_type;
@@ -189,7 +190,7 @@ static int open_ac3_file(demux_ac3_t *this) {
lprintf("found the start of the data at offset %d\n", offset);
break;
} else
- offset += chunk_size;
+ offset += 8 + chunk_size;
}
}
diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c
index 81d4470ec..a2425c901 100644
--- a/src/demuxers/demux_dts.c
+++ b/src/demuxers/demux_dts.c
@@ -114,6 +114,7 @@ static int open_dts_file(demux_dts_t *this) {
/* Check for wav header, as we'll handle DTS with a wav header shoved
* on the front for CD burning */
+ /* FIXME: This is risky. Real LPCM may contain anything, even sync words. */
if ( memcmp(peak, "RIFF", 4) == 0 || memcmp(&peak[8], "WAVEfmt ", 8) == 0 ) {
/* Check this looks like a cd audio wav */
unsigned int audio_type;
@@ -139,7 +140,7 @@ static int open_dts_file(demux_dts_t *this) {
lprintf("found the start of the data at offset %d\n", offset);
break;
} else
- offset += chunk_size;
+ offset += 8 + chunk_size;
}
}