From cbb21e30d5cd18d17d60a049087f98a82c2862b9 Mon Sep 17 00:00:00 2001 From: Michael Goddard Date: Fri, 21 Oct 2011 11:32:21 +1000 Subject: Limit the sequential bytes skipping to a max 16kB at a time. Otherwise QIODevice::read will try and allocate whatever junk is passed in, so a corrupt chunk can result in 1GB+ allocations which are never actually used. Change-Id: I1ea4a5c1a5d21b1ee6f7e428105c52c0ee6ca7f7 Reviewed-by: Jonas Rabbe --- src/multimedia/effects/qwavedecoder_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/multimedia') diff --git a/src/multimedia/effects/qwavedecoder_p.cpp b/src/multimedia/effects/qwavedecoder_p.cpp index 8ee0d59c2..eb65a3aca 100644 --- a/src/multimedia/effects/qwavedecoder_p.cpp +++ b/src/multimedia/effects/qwavedecoder_p.cpp @@ -290,7 +290,7 @@ void QWaveDecoder::discardBytes(qint64 numBytes) // If the iodevice doesn't have this many bytes in it, // remember how much more junk we have to skip. if (source->isSequential()) { - QByteArray r = source->read(numBytes); // uggh, wasted memory + QByteArray r = source->read(qMin(numBytes, qint64(16384))); // uggh, wasted memory, limit to a max of 16k if (r.size() < numBytes) junkToSkip = numBytes - r.size(); else -- cgit v1.2.3