summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-01 13:04:10 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-17 12:20:14 (GMT)
commitbcf965462f07e7772754777aeb64dab9591ba0b0 (patch)
tree1e765daee162e354c25784896a42eb8648d9e65f /src/multimedia
parentec6777f809983a80f3258417769afd495a834b43 (diff)
downloadQt-bcf965462f07e7772754777aeb64dab9591ba0b0.zip
Qt-bcf965462f07e7772754777aeb64dab9591ba0b0.tar.gz
Qt-bcf965462f07e7772754777aeb64dab9591ba0b0.tar.bz2
Fixed buffer overrun in Symbian QAudioInput backend
Task-number: QTBUG-13058 Reviewed-by: Derick Hawcroft
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudioinput_symbian_p.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/multimedia/audio/qaudioinput_symbian_p.cpp b/src/multimedia/audio/qaudioinput_symbian_p.cpp
index 9d240ca..9ae4368 100644
--- a/src/multimedia/audio/qaudioinput_symbian_p.cpp
+++ b/src/multimedia/audio/qaudioinput_symbian_p.cpp
@@ -373,7 +373,8 @@ qint64 QAudioInputPrivate::read(char *data, qint64 len)
TDesC8 &inputBuffer = buffer->Data();
- const qint64 inputBytes = bytesReady();
+ Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos);
+ const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos;
const qint64 outputBytes = len - bytesRead;
const qint64 copyBytes = outputBytes < inputBytes ?
outputBytes : inputBytes;
@@ -384,7 +385,7 @@ qint64 QAudioInputPrivate::read(char *data, qint64 len)
data += copyBytes;
bytesRead += copyBytes;
- if (!bytesReady())
+ if (inputBytes == copyBytes)
bufferEmptied();
}
@@ -403,13 +404,14 @@ void QAudioInputPrivate::pullData()
TDesC8 &inputBuffer = buffer->Data();
- const qint64 inputBytes = bytesReady();
+ Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos);
+ const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos;
const qint64 bytesPushed = m_sink->write(
(char*)inputBuffer.Ptr() + m_devSoundBufferPos, inputBytes);
m_devSoundBufferPos += bytesPushed;
- if (!bytesReady())
+ if (inputBytes == bytesPushed)
bufferEmptied();
if (!bytesPushed)