Thanks! Pushed fix in
http://git.savannah.gnu.org/cgit/screen.git/commit/?id=548eebae59f7b91b55587cfe5b580eb02a2d416d

Sadrul

On Fri, Aug 10, 2012 at 3:24 PM, Michael Spang <sp...@google.com> wrote:

> Screen can be segfaulted with the following steps:
>
>   - Start screen
>   - Enable altscreen with ":altscreen on"
>   - Enable caption with ":caption always"
>   - Run vim
>   - Resize the current terminal to one line high
>   - Resize the current terminal to multiple lines high
>   - Quit vim
>
> This happens because if the canvas height is 0, the alt cursor will be
> adjusted to he - 1 == -1. When we later restore this cursor screen
> crashes. I've reordered the sanity checks for w_saved in case there is
> a similar bug for the saved cursor.
> ---
>
> This fixes the same bug as the previous patch "Forbid creation of
> zero-height canvas".
>
> ChangeLog
>
> v2 - This is a less paranoid version that just fixes the one
> problematic path. It allows screen to render correctly when the only
> available line is taken by the caption.
>
>  src/resize.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/resize.c b/src/resize.c
> index 0e491eb..3c2b90f 100644
> --- a/src/resize.c
> +++ b/src/resize.c
> @@ -966,14 +966,16 @@ int wi, he, hi;
>      p->w_y = he - 1;
>    if (p->w_saved.x > wi)
>      p->w_saved.x = wi;
> -  if (p->w_saved.y < 0)
> -    p->w_saved.y = 0;
>    if (p->w_saved.y >= he)
>      p->w_saved.y = he - 1;
> +  if (p->w_saved.y < 0)
> +    p->w_saved.y = 0;
>    if (p->w_alt.cursor.x > wi)
>      p->w_alt.cursor.x = wi;
>    if (p->w_alt.cursor.y >= he)
>      p->w_alt.cursor.y = he - 1;
> +  if (p->w_alt.cursor.y < 0)
> +    p->w_alt.cursor.y = 0;
>
>    /* reset scrolling region */
>    p->w_top = 0;
> --
> 1.7.7.3
>
>
> _______________________________________________
> screen-users mailing list
> screen-users@gnu.org
> https://lists.gnu.org/mailman/listinfo/screen-users
>
_______________________________________________
screen-users mailing list
screen-users@gnu.org
https://lists.gnu.org/mailman/listinfo/screen-users

Reply via email to