Explorar el Código

Fix depth sanity test in PixelFormat

tags/v1.10.90
Pierre Ossman hace 4 años
padre
commit
f1b9b868ec
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 1
    1
      common/rfb/PixelFormat.cxx
  2. 4
    0
      tests/unit/pixelformat.cxx

+ 1
- 1
common/rfb/PixelFormat.cxx Ver fichero

@@ -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 Ver fichero

@@ -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);

Cargando…
Cancelar
Guardar