diff options
author | Blake Tregre <blake.tregre@gmail.com> | 2014-08-28 09:53:17 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-08-28 09:53:17 +0300 |
commit | 105b52e88a097bdbc18f01a79851c8432de773df (patch) | |
tree | 01ca6c7e3ca7a54dc69782c3435ed68b252b1ed1 /gst/librfb | |
parent | 33fedda48977f6cd84aa0e3fd37749144f59e445 (diff) | |
download | gstreamer-plugins-bad-105b52e88a097bdbc18f01a79851c8432de773df.tar.gz |
rfbsrc: Clamp out of bounds resolutions to prevent segfaults
https://bugzilla.gnome.org/show_bug.cgi?id=726801
Diffstat (limited to 'gst/librfb')
-rw-r--r-- | gst/librfb/rfbdecoder.c | 18 |
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; } |