diff options
author | hawcroft <derick.hawcroft@nokia.com> | 2011-10-10 13:55:02 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-10 07:18:02 +0200 |
commit | cee992cdd65e53d2efc2069b1f64daabf97efea6 (patch) | |
tree | 479dbaa5ea5d176c6c082b3703c2a8af94ac4e94 /src | |
parent | adca03adfd80c0a87083d73e8d8c71229fc35652 (diff) |
bail out in case of missing descriptors
Change-Id: I7c231367a4b5ef2d15fd1a7af2c2a6c1d51c9460
Reviewed-on: http://codereview.qt-project.org/6279
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/multimedia/effects/qwavedecoder_p.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/multimedia/effects/qwavedecoder_p.cpp b/src/multimedia/effects/qwavedecoder_p.cpp index 19b262adc..e173aed8d 100644 --- a/src/multimedia/effects/qwavedecoder_p.cpp +++ b/src/multimedia/effects/qwavedecoder_p.cpp @@ -106,6 +106,7 @@ qint64 QWaveDecoder::writeData(const char *data, qint64 len) void QWaveDecoder::handleData() { + bool valid = true; if (state == QWaveDecoder::InitialState) { if (source->bytesAvailable() < qint64(sizeof(RIFFHeader))) return; @@ -125,7 +126,7 @@ void QWaveDecoder::handleData() } if (state == QWaveDecoder::WaitingForFormatState) { - if (findChunk("fmt ")) { + if (valid = findChunk("fmt ")) { chunk descriptor; source->peek(reinterpret_cast<char *>(&descriptor), sizeof(chunk)); @@ -158,7 +159,7 @@ void QWaveDecoder::handleData() } if (state == QWaveDecoder::WaitingForDataState) { - if (findChunk("data")) { + if (valid = findChunk("data")) { source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); chunk descriptor; @@ -173,7 +174,7 @@ void QWaveDecoder::handleData() } } - if (source->atEnd()) { + if (source->atEnd() || !valid) { source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData())); emit invalidFormat(); |