Handle pixel formats with odd shift values

Our fast paths assume that each channel fits in to a separate byte.
That means the shift needs to be a multiple of 8. Start actually
checking this so that a client cannot trip us up and possibly cause
incorrect code exection.

Issue found by Pavel Cheremushkin from Kaspersky Lab.
This commit is contained in:
Pierre Ossman 2019-10-02 16:06:08 +02:00 committed by Lauri Kasanen
parent ae6cbd19e9
commit ed73ac2aa7

View File

@ -205,6 +205,12 @@ bool PixelFormat::is888(void) const
return false;
if (blueMax != 255)
return false;
if ((redShift & 0x7) != 0)
return false;
if ((greenShift & 0x7) != 0)
return false;
if ((blueShift & 0x7) != 0)
return false;
return true;
}