- Sep 17, 2019
-
-
Li Qiang authored
Currently when qemu receives a vnc connect, it creates a 'VncState' to represent this connection. In 'vnc_worker_thread_loop' it creates a local 'VncState'. The connection 'VcnState' and local 'VncState' exchange data in 'vnc_async_encoding_start' and 'vnc_async_encoding_end'. In 'zrle_compress_data' it calls 'deflateInit2' to allocate the libz library opaque data. The 'VncState' used in 'zrle_compress_data' is the local 'VncState'. In 'vnc_zrle_clear' it calls 'deflateEnd' to free the libz library opaque data. The 'VncState' used in 'vnc_zrle_clear' is the connection 'VncState'. In currently implementation there will be a memory leak when the vnc disconnect. Following is the asan output backtrack: Direct leak of 29760 byte(s) in 5 object(s) allocated from: 0 0xffffa67ef3c3 in __interceptor_calloc (/lib64/libasan.so.4+0xd33c3) 1 0xffffa65071cb in g_malloc0 (/lib64/libglib-2.0.so.0+0x571cb) 2 0xffffa5e968f7 in deflateInit2_ (/lib64/libz.so.1+0x78f7) 3 0xaaaacec58613 in zrle_compress_data ui/vnc-enc-zrle.c:87 4 0xaaaacec58613 in zrle_send_framebuffer_update ui/vnc-enc-zrle.c:344 5 0xaaaacec34e77 in vnc_send_framebuffer_update ui/vnc.c:919 6 0xaaaacec5e023 in vnc_worker_thread_loop ui/vnc-jobs.c:271 7 0xaaaacec5e5e7 in vnc_worker_thread ui/vnc-jobs.c:340 8 0xaaaacee4d3c3 in qemu_thread_start util/qemu-thread-posix.c:502 9 0xffffa544e8bb in start_thread (/lib64/libpthread.so.0+0x78bb) 10 0xffffa53965cb in thread_start (/lib64/libc.so.6+0xd55cb) This is because the opaque allocated in 'deflateInit2' is not freed in 'deflateEnd'. The reason is that the 'deflateEnd' calls 'deflateStateCheck' and in the latter will check whether 's->strm != strm'(libz's data structure). This check will be true so in 'deflateEnd' it just return 'Z_STREAM_ERROR' and not free the data allocated in 'deflateInit2'. The reason this happens is that the 'VncState' contains the whole 'VncZrle', so when calling 'deflateInit2', the 's->strm' will be the local address. So 's->strm != strm' will be true. To fix this issue, we need to make 'zrle' of 'VncState' to be a pointer. Then the connection 'VncState' and local 'VncState' exchange mechanism will work as expection. The 'tight' of 'VncState' has the same issue, let's also turn it to a pointer. Reported-by:
Ying Fang <fangying1@huawei.com> Signed-off-by:
Li Qiang <liq3ea@163.com> Message-id: 20190831153922.121308-1-liq3ea@163.com Signed-off-by:
Gerd Hoffmann <kraxel@redhat.com>
-
- Feb 04, 2016
-
-
Peter Maydell authored
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by:
Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-2-git-send-email-peter.maydell@linaro.org
-
- Aug 21, 2011
-
-
Anthony Liguori authored
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Apr 09, 2011
-
-
Michael Tokarev authored
fix 2Gb integer overflow in in VNC tight and zlib encodings As found by Roland Dreier <roland@purestorage.com> (excellent catch!), when amount of VNC compressed data produced by zlib and sent to client exceeds 2Gb, integer overflow occurs because currently, we calculate amount of data produced at each step by comparing saved total_out with new total_out, and total_out is something which grows without bounds. Compare it with previous avail_out instead of total_out, and leave total_out alone. The same code is used in vnc-enc-tight.c and vnc-enc-zlib.c, so fix both cases. There, there's no actual need to save previous_out value, since capacity-offset (which is how that value is calculated) stays the same so it can be recalculated again after call to deflate(), but whole thing becomes less readable this way. Reported-by:
Roland Dreier <roland@purestorage.com> Signed-off-by:
Michael Tokarev <mjt@tls.msk.ru> Signed-off-by:
Corentin Chary <corentin.chary@gmail.com> Signed-off-by:
Aurelien Jarno <aurelien@aurel32.net>
-
- Jul 26, 2010
-
-
Corentin Chary authored
This will allow to implement the threaded VNC server in a more cleaner way. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
For the same reason that we don't use vnc-authentication-sasl.c but vnc-auth-sals.c. Because it's tooooo long. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
Move sdl, vnc, curses and cocoa UI into ui/ to cleanup the root directory. Also remove some unnecessary explicit targets from Makefile. aliguori: fix build when srcdir != objdir Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Jun 01, 2010
-
-
Corentin Chary authored
Add support for tight encoding [1]. This patch only add support for "basic" tight compression without any filter. [1] http://tigervnc.org/cgi-bin/rfbproto#tight-encoding . Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
Some encodings like tight supports tiling (spliting in multiple sub-rectangles). So we needed a way to tell vnc_update_client() how much rectangles are in the buffer. zlib, raw and hextile always send a full rectangle. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
Makes sure we free all ressources used in zlib encoding (zlib stream and buffer). Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
On init, values are already NULL, but we shouldn't try to reset them each time a client send a set encoding command because this break everything. For example, libvncclient re-send a set encoding command if the framebuffer is resized. This fix framebuffer resizing for zlib encoding. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
Adjust zlib compression level if needed by calling deflateParams. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
Corentin Chary authored
According to http://tigervnc.org/cgi-bin/rfbproto#zlib-encoding zlib encoding only uses a single stream. Current implementation defines 4 streams but only uses the first one. Remove them and only use a single stream. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- May 03, 2010
-
-
Corentin Chary authored
This will allow to implement new encodings (tight, zrle, ..) in a cleaner way. This may hurt performances, because some functions like vnc_convert_pixel are not static anymore, but should not be a problem with gcc 4.5 and the new -flto. Signed-off-by:
Corentin Chary <corentincj@iksaif.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-