Kaydet (Commit) 35412949 authored tarafından Caolán McNamara's avatar Caolán McNamara

keep nScanlineStride number sane

bff + valgrind

Change-Id: I255a052251a6a0f1e4005b9cfb3b6ce00c6653ee
üst 80748411
...@@ -1952,12 +1952,15 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& ...@@ -1952,12 +1952,15 @@ BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector&
nScanlineFormat > FORMAT_MAX ) nScanlineFormat > FORMAT_MAX )
return BitmapDeviceSharedPtr(); return BitmapDeviceSharedPtr();
sal_uInt8 nBitsPerPixel = bitsPerPixel[nScanlineFormat];
if (rSize.getX() > (SAL_MAX_INT32-7) / nBitsPerPixel)
sal_Int32 nScanlineStride(0); {
SAL_WARN("basebmp", "suspicious bitmap width " <<
rSize.getX() << " for depth " << nBitsPerPixel);
return BitmapDeviceSharedPtr();
}
// round up to full 8 bit, divide by 8 // round up to full 8 bit, divide by 8
nScanlineStride = (rSize.getX()*bitsPerPixel[nScanlineFormat] + 7) >> 3; sal_Int32 nScanlineStride = (rSize.getX()*nBitsPerPixel + 7) >> 3;
// rounded up to next full power-of-two number of bytes // rounded up to next full power-of-two number of bytes
const sal_uInt32 bytesPerPixel = nextPow2( const sal_uInt32 bytesPerPixel = nextPow2(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment