]> xenbits.xensource.com Git - qemu-xen.git/commit
vnc: fix memory corruption (CVE-2015-5225)
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 17 Aug 2015 17:56:53 +0000 (19:56 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 21 Sep 2015 22:03:16 +0000 (17:03 -0500)
commitefec4dcd2552e85ed57f276b58f09fc385727450
tree96b5607af5ae002d3eddaacbfca29d4937310673
parent5c79ae3615d5dafdf1bb09b7a356a3a005714e3d
vnc: fix memory corruption (CVE-2015-5225)

The _cmp_bytes variable added by commit "bea60dd ui/vnc: fix potential
memory corruption issues" can become negative.  Result is (possibly
exploitable) memory corruption.  Reason for that is it uses the stride
instead of bytes per scanline to apply limits.

For the server surface is is actually fine.  vnc creates that itself,
there is never any padding and thus scanline length always equals stride.

For the guest surface scanline length and stride are typically identical
too, but it doesn't has to be that way.  So add and use a new variable
(guest_ll) for the guest scanline length.  Also rename min_stride to
line_bytes to make more clear what it actually is.  Finally sprinkle
in an assert() to make sure we never use a negative _cmp_bytes again.

Reported-by: 范祚至(库特) <zuozhi.fzz@alibaba-inc.com>
Reviewed-by: P J P <ppandit@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit eb8934b0418b3b1d125edddc4fc334a54334a49b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
ui/vnc.c