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>
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user