Browse Source

Fix depth sanity test in PixelFormat

tags/v1.10.90
Pierre Ossman 4 years ago
parent
commit
f1b9b868ec
2 changed files with 5 additions and 1 deletions
  1. 1
    1
      common/rfb/PixelFormat.cxx
  2. 4
    0
      tests/unit/pixelformat.cxx

+ 1
- 1
common/rfb/PixelFormat.cxx View File

@@ -679,7 +679,7 @@ bool PixelFormat::isSane(void)
return false;

totalBits = bits(redMax) + bits(greenMax) + bits(blueMax);
if (totalBits > bpp)
if (totalBits > depth)
return false;

if (((redMax << redShift) & (greenMax << greenShift)) != 0)

+ 4
- 0
tests/unit/pixelformat.cxx View File

@@ -104,6 +104,10 @@ int main(int argc, char** argv)
doTest(true, 32, 24, false, true, 127, 511, 127, 0, 4, 20);
doTest(true, 32, 24, false, true, 127, 127, 511, 0, 4, 8);

/* Insufficient depth */

doTest(true, 32, 16, false, true, 255, 255, 255, 0, 8, 16);

/* Overlapping channels */

doTest(true, 32, 24, false, true, 255, 255, 255, 0, 7, 16);

Loading…
Cancel
Save