summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeslie Zhai <[email protected]>2017-12-02 15:11:11 +0800
committerLeslie Zhai <[email protected]>2017-12-02 15:11:11 +0800
commit947aebe181cda58933eafc28d0c46f7dc0515453 (patch)
tree87ca843e8e73fa634c42766e7c8a5f5209747f3d
parent5c08b0511583b954d000167fce9261453fdc54c1 (diff)
Fix potential null passed to a callee that requires a non-null argument.
-rw-r--r--plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
index a371dc6..b141883 100644
--- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
@@ -278,15 +278,18 @@ QString K3bFFMpegFile::comment() const
}
-int K3bFFMpegFile::read( char* buf, int bufLen )
+int K3bFFMpegFile::read(char* buf, int bufLen)
{
+ if (!buf || !d->outputBufferPos)
+ return -1;
+
int ret = fillOutputBuffer();
if (ret <= 0) {
return ret;
}
int len = qMin(bufLen, d->outputBufferSize);
- ::memcpy( buf, d->outputBufferPos, len );
+ ::memcpy(buf, d->outputBufferPos, len);
// TODO: only swap if needed
for( int i = 0; i < len-1; i+=2 ) {