summaryrefslogtreecommitdiff
path: root/src/multimedia/audio
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-01 14:04:10 +0100
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-17 13:20:14 +0100
commitbcf965462f07e7772754777aeb64dab9591ba0b0 (patch)
tree1e765daee162e354c25784896a42eb8648d9e65f /src/multimedia/audio
parentec6777f809983a80f3258417769afd495a834b43 (diff)
downloadqt4-tools-bcf965462f07e7772754777aeb64dab9591ba0b0.tar.gz
Fixed buffer overrun in Symbian QAudioInput backend
Task-number: QTBUG-13058 Reviewed-by: Derick Hawcroft
Diffstat (limited to 'src/multimedia/audio')
-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 9d240cad30..9ae4368378 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)