mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
rfbsrc: Clamp out of bounds resolutions to prevent segfaults
https://bugzilla.gnome.org/show_bug.cgi?id=726801
This commit is contained in:
parent
33fedda489
commit
105b52e88a
1 changed files with 14 additions and 4 deletions
|
@ -663,28 +663,38 @@ rfb_decoder_state_wait_for_server_initialisation (RfbDecoder * decoder)
|
||||||
|
|
||||||
if (decoder->offset_x > 0) {
|
if (decoder->offset_x > 0) {
|
||||||
if (decoder->offset_x > decoder->width) {
|
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 {
|
} else {
|
||||||
decoder->width -= decoder->offset_x;
|
decoder->width -= decoder->offset_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (decoder->offset_y > 0) {
|
if (decoder->offset_y > 0) {
|
||||||
if (decoder->offset_y > decoder->height) {
|
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 {
|
} else {
|
||||||
decoder->height -= decoder->offset_y;
|
decoder->height -= decoder->offset_y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (decoder->rect_width > 0) {
|
if (decoder->rect_width > 0) {
|
||||||
if (decoder->rect_width > decoder->width) {
|
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 {
|
} else {
|
||||||
decoder->width = decoder->rect_width;
|
decoder->width = decoder->rect_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (decoder->rect_height > 0) {
|
if (decoder->rect_height > 0) {
|
||||||
if (decoder->rect_height > decoder->height) {
|
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 {
|
} else {
|
||||||
decoder->height = decoder->rect_height;
|
decoder->height = decoder->rect_height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue