Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Fwd: Re: [PATCH] {,un}applychange: do not call zle_setline(NULL) if quietgethist() fails
- X-seq: zsh-workers 44450
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Fwd: Re: [PATCH] {,un}applychange: do not call zle_setline(NULL) if quietgethist() fails
- Date: Wed, 26 Jun 2019 12:00:44 +0100 (BST)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com; s=meg.feb2017; t=1561546845; bh=n+PBnO4Fap6/2Lc6wo64m4Ij8h82aoYEsQigMfoD4xI=; h=Date:From:To:In-Reply-To:References:Subject; b=lFIV4sQUfavxxe3epULJkT4Jm8shgbLt9+t7OPv1icRhKU00VUx73uTxXe1BiK0vc P7XvyEJooDHiZd/UMpMckYfNkeupZf5fDnb9d3USkge1JmmKH1la+IYMGegZJDfyQu DSUiqXTOomZ52KItDAaihiAlb6sf5R/ELuJVOdapOIJkw348tqMAO32B+b1hPvscmV V6FN6M9zmRTo2Zh9x2nvd8TGKfo0yA2Ha/79pGkj5sfnADIg4NtdlgK/ND0Le6Ngf2 srQhT3bmX4yzCaW27NUDt5c7UsKqZHMcs+zkhaIipmaXzM8aZjC5xQhHkcgJnf7sK2 hHS4y6RDOE1OA==
- Importance: Medium
- In-reply-to: <249696510.1723352.1561545091592@mail2.virginmedia.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20190626101908.548-1-kdudka@redhat.com> <249696510.1723352.1561545091592@mail2.virginmedia.com>
Sorry, this should have gone to the list...
---------- Original Message ----------
From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
To: Kamil Dudka <kdudka@xxxxxxxxxx>
Date: 26 June 2019 at 11:31
Subject: Re: [PATCH] {,un}applychange: do not call zle_setline(NULL) if quietgethist() fails
> On 26 June 2019 at 11:19 Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
>
>
> There is a bug report in Red Hat Bugzilla about zsh crashing on NULL
> pointer dereference: https://bugzilla.redhat.com/1722703
>
> I was not able to reproduce the crash myself but the attached patch
> should prevent zsh from crashing in this situation.
Hmm... I'm guessing that in the failure case we probably shouldn't
set zlecs either? It's probably not going to do anything helpful.
Possibly also return 1?
pws
> Src/Zle/zle_utils.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
> index 0277d4917..8081d3adc 100644
> --- a/Src/Zle/zle_utils.c
> +++ b/Src/Zle/zle_utils.c
> @@ -1607,7 +1607,9 @@ static int
> unapplychange(struct change *ch)
> {
> if(ch->hist != histline) {
> - zle_setline(quietgethist(ch->hist));
> + Histent he = quietgethist(ch->hist);
> + if(he)
> + zle_setline(he);
> zlecs = ch->new_cs;
> return 0;
> }
> @@ -1647,7 +1649,9 @@ static int
> applychange(struct change *ch)
> {
> if(ch->hist != histline) {
> - zle_setline(quietgethist(ch->hist));
> + Histent he = quietgethist(ch->hist);
> + if(he)
> + zle_setline(he);
> zlecs = ch->old_cs;
> return 0;
> }
> --
> 2.20.1
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author