Commit cf2d385c43b4387bec5a546c9b85ac654273cfa3
1 parent
2abec30b
Crop VNC update requests to avoid segfaults, by Thomas Tuttle.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2741 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
0 deletions
vnc.c
| ... | ... | @@ -852,6 +852,15 @@ static void framebuffer_update_request(VncState *vs, int incremental, |
| 852 | 852 | int x_position, int y_position, |
| 853 | 853 | int w, int h) |
| 854 | 854 | { |
| 855 | + if (x_position > vs->ds->width) | |
| 856 | + x_position = vs->ds->width; | |
| 857 | + if (y_position > vs->ds->height) | |
| 858 | + y_position = vs->ds->height; | |
| 859 | + if (x_position + w >= vs->ds->width) | |
| 860 | + w = vs->ds->width - x_position; | |
| 861 | + if (y_position + h >= vs->ds->height) | |
| 862 | + h = vs->ds->height - y_position; | |
| 863 | + | |
| 855 | 864 | int i; |
| 856 | 865 | vs->need_update = 1; |
| 857 | 866 | if (!incremental) { | ... | ... |