diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-10 11:56:00 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-03-10 11:56:00 +0000 |
commit | 3d21afb8aac5da0139d85498607d40c748b6db53 (patch) | |
tree | ce80b5e196fa4dff556d0a34c9dc0cb368adbd5b /vcl/source | |
parent | 89914fee18f9cc5354e21073f97c8121db7df85f (diff) |
ofz#787 avoid bmp oom
Change-Id: Id5d1a1b8dd6d4e78bef9d09ab68d1e7daf7e1bd5
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/dibtools.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 4fa6cc668b09..534a50dec7ac 100644 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -530,8 +530,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r rHeader.nSizeImage = rIStm.remainingSize(); } - std::unique_ptr<sal_uInt8[]> pBuffer( - new sal_uInt8[rHeader.nSizeImage]); + if (rHeader.nSizeImage > rIStm.remainingSize()) + return false; + std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[rHeader.nSizeImage]); if (rIStm.ReadBytes(pBuffer.get(), rHeader.nSizeImage) != rHeader.nSizeImage) { |