summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Tregre <blake.tregre@gmail.com>2014-08-28 09:53:17 +0300
committerSebastian Dröge <sebastian@centricular.com>2014-08-28 09:53:17 +0300
commit105b52e88a097bdbc18f01a79851c8432de773df (patch)
tree01ca6c7e3ca7a54dc69782c3435ed68b252b1ed1
parent33fedda48977f6cd84aa0e3fd37749144f59e445 (diff)
rfbsrc: Clamp out of bounds resolutions to prevent segfaults
https://bugzilla.gnome.org/show_bug.cgi?id=726801
-rw-r--r--gst/librfb/rfbdecoder.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gst/librfb/rfbdecoder.c b/gst/librfb/rfbdecoder.c
index de762edd3..88f3b0382 100644
--- a/gst/librfb/rfbdecoder.c
+++ b/gst/librfb/rfbdecoder.c
@@ -663,28 +663,38 @@ rfb_decoder_state_wait_for_server_initialisation (RfbDecoder * decoder)
if (decoder->offset_x > 0) {
if (decoder->offset_x > decoder->width) {
- GST_WARNING ("Trying to crop more than the width of the server");
+ GST_WARNING
+ ("Trying to crop more than the width of the server. Setting offset-x to 0.");
+ decoder->offset_x = 0;
} else {
decoder->width -= decoder->offset_x;
}
}
if (decoder->offset_y > 0) {
if (decoder->offset_y > decoder->height) {
- GST_WARNING ("Trying to crop more than the height of the server");
+ GST_WARNING
+ ("Trying to crop more than the height of the server. Setting offset-y to 0.");
+ decoder->offset_y = 0;
} else {
decoder->height -= decoder->offset_y;
}
}
if (decoder->rect_width > 0) {
if (decoder->rect_width > decoder->width) {
- GST_WARNING ("Trying to crop more than the width of the server");
+ GST_WARNING
+ ("Trying to crop more than the width of the server. Setting width to %u.",
+ decoder->width);
+ decoder->rect_width = decoder->width;
} else {
decoder->width = decoder->rect_width;
}
}
if (decoder->rect_height > 0) {
if (decoder->rect_height > decoder->height) {
- GST_WARNING ("Trying to crop more than the height of the server");
+ GST_WARNING
+ ("Trying to crop more than the height of the server. Setting height to %u.",
+ decoder->height);
+ decoder->rect_height = decoder->height;
} else {
decoder->height = decoder->rect_height;
}