From: "Herongguang (Stephen)" <herongguang.he@huawei.com>
To: qemu-devel@nongnu.org, kraxel@redhat.com, pbonzini@redhat.com,
herongguang.he@huawei.com, weidong.huang@huawei.com,
"peter.huangpeng@huawei.com >> Huangpeng (Peter)"
<peter.huangpeng@huawei.com>
Subject: [Qemu-devel] [PATCH] vnc-enc-tight: fix off-by-one bug
Date: Tue, 12 Jul 2016 17:31:23 +0800 [thread overview]
Message-ID: <5784B8EB.7010008@huawei.com> (raw)
In tight_encode_indexed_rect32, buf(or src)’s size is count. In for loop,
the logic is supposed to be that i is an index into src, i should be
incremented when incrementing src.
This is broken when src is incremented but i is not before while loop,
resulting in off-by-one bug in while loop.
Signed-off-by: He Rongguang <herongguang.he@huawei.com>
---
ui/vnc-enc-tight.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index e5cba0e..678c5df 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -461,9 +461,10 @@ static int tight_fill_palette(VncState *vs, int x, int y,
\
src = (uint##bpp##_t *) buf; \
\
- for (i = 0; i < count; i++) { \
+ for (i = 0; i < count; ) { \
\
rgb = *src++; \
+ i++; \
rep = 0; \
while (i < count && *src == rgb) { \
rep++, src++, i++; \
--
1.8.3.4
next reply other threads:[~2016-07-12 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-12 9:31 Herongguang (Stephen) [this message]
2016-07-15 10:10 ` [Qemu-devel] [PATCH] vnc-enc-tight: fix off-by-one bug Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5784B8EB.7010008@huawei.com \
--to=herongguang.he@huawei.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=weidong.huang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.