This should hopefully fix an overflow exception while decoding the dib format.

This commit is contained in:
Robin Krom 2022-06-30 23:34:51 +02:00
parent 48675b01f0
commit bfa8e2444e
No known key found for this signature in database
GPG key ID: BCC01364F1371490

View file

@ -100,8 +100,7 @@ namespace Greenshot.Editor.FileFormatHandlers
bitmap = new Bitmap(infoHeader.Width, infoHeader.Height,
-(int)(infoHeader.SizeImage / infoHeader.Height),
infoHeader.BitCount == 32 ? PixelFormat.Format32bppArgb : PixelFormat.Format24bppRgb,
new IntPtr(handle.AddrOfPinnedObject().ToInt32() + infoHeader.OffsetToPixels +
(infoHeader.Height - 1) * (int)(infoHeader.SizeImage / infoHeader.Height))
IntPtr.Add(handle.AddrOfPinnedObject(), (int)infoHeader.OffsetToPixels + (infoHeader.Height - 1) * (int)(infoHeader.SizeImage / infoHeader.Height))
);
}
catch (Exception ex)