How do I avoid heap corruption when populating an indexed bitmap using Bitmap.LockBits and Marshal.Copy?
I want to programmatically create indexed bitmaps in formats other than PixelFormat.Format8bppIndexed
and need help in understanding why my current implementation is causing heap corruption.