[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/9] vnc: Fix tight_detect_smooth_image() for lossles
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/9] vnc: Fix tight_detect_smooth_image() for lossless case |
Date: |
Mon, 10 Mar 2014 13:49:05 +0100 |
From: Markus Armbruster <address@hidden>
VncTight member uint8_t quality is either (uint8_t)-1 for lossless or
less than 10 for lossy.
tight_detect_smooth_image() first promotes it to int, then compares
with -1. Always unequal, so we always execute the lossy code. Reads
beyond tight_conf[] and returns crap when quality is actually
lossless.
Compare to (uint8_t)-1 instead, like we do elsewhere.
Spotted by Coverity.
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/vnc-enc-tight.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index e6966ae..59b59c0 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -330,7 +330,7 @@ tight_detect_smooth_image(VncState *vs, int w, int h)
} else {
errors = tight_detect_smooth_image16(vs, w, h);
}
- if (quality != -1) {
+ if (quality != (uint8_t)-1) {
return (errors < tight_conf[quality].jpeg_threshold);
}
return (errors < tight_conf[compression].gradient_threshold);
--
1.8.3.1
- [Qemu-devel] [PULL 0/9] vnc patches, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 3/9] vnc: fix use-after-free in vnc_update_client_sync, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 2/9] vnc: Fix qemu crashed when vnc client disconnect suddenly, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 1/9] vnc: Fix tight_detect_smooth_image() for lossless case,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 4/9] ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macro, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 6/9] ui/vnc: optimize dirty bitmap tracking, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 9/9] ui/vnc: disable adaptive update calculations if not needed, Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 7/9] ui/vnc: optimize clearing in find_and_clear_dirty_height(), Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 8/9] ui/vnc: optimize setting in vnc_dpy_update(), Gerd Hoffmann, 2014/03/10
- [Qemu-devel] [PULL 5/9] ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BIT, Gerd Hoffmann, 2014/03/10
- Re: [Qemu-devel] [PULL 0/9] vnc patches, Peter Maydell, 2014/03/11