Blame 0001-zsh-5.7.1-zle-history-avoid-crash.patch

Kamil Dudka 143732
From 15c190164c375cfe1772ebec92b544ca26a60e28 Mon Sep 17 00:00:00 2001
Kamil Dudka 143732
From: Kamil Dudka <kdudka@redhat.com>
Kamil Dudka 143732
Date: Tue, 23 Jul 2019 14:45:48 +0200
Kamil Dudka 143732
Subject: [PATCH 1/2] 44566: make sure Zle doesn't crash if history entry not
Kamil Dudka 143732
 found
Kamil Dudka 143732
Kamil Dudka 143732
Upstream-commit: f9cd2187875b6f2ebdb9b9a787fac20b2aaf745b
Kamil Dudka 143732
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Kamil Dudka 143732
---
Kamil Dudka 143732
 Src/Zle/zle_utils.c | 14 ++++++++++++--
Kamil Dudka 143732
 1 file changed, 12 insertions(+), 2 deletions(-)
Kamil Dudka 143732
Kamil Dudka 143732
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
Kamil Dudka 143732
index c6df3d8..633f593 100644
Kamil Dudka 143732
--- a/Src/Zle/zle_utils.c
Kamil Dudka 143732
+++ b/Src/Zle/zle_utils.c
Kamil Dudka 143732
@@ -1607,7 +1607,12 @@ static int
Kamil Dudka 143732
 unapplychange(struct change *ch)
Kamil Dudka 143732
 {
Kamil Dudka 143732
     if(ch->hist != histline) {
Kamil Dudka 143732
-	zle_setline(quietgethist(ch->hist));
Kamil Dudka 143732
+	Histent he = quietgethist(ch->hist);
Kamil Dudka 143732
+	if(!he) {
Kamil Dudka 143732
+	    dputs(ERRMSG("quietgethist(ch->hist) returned NULL"));
Kamil Dudka 143732
+	    return 1;
Kamil Dudka 143732
+	}
Kamil Dudka 143732
+	zle_setline(he);
Kamil Dudka 143732
 	zlecs = ch->new_cs;
Kamil Dudka 143732
 	return 0;
Kamil Dudka 143732
     }
Kamil Dudka 143732
@@ -1647,7 +1652,12 @@ static int
Kamil Dudka 143732
 applychange(struct change *ch)
Kamil Dudka 143732
 {
Kamil Dudka 143732
     if(ch->hist != histline) {
Kamil Dudka 143732
-	zle_setline(quietgethist(ch->hist));
Kamil Dudka 143732
+	Histent he = quietgethist(ch->hist);
Kamil Dudka 143732
+	if(!he) {
Kamil Dudka 143732
+	    dputs(ERRMSG("quietgethist(ch->hist) returned NULL"));
Kamil Dudka 143732
+	    return 1;
Kamil Dudka 143732
+	}
Kamil Dudka 143732
+	zle_setline(he);
Kamil Dudka 143732
 	zlecs = ch->old_cs;
Kamil Dudka 143732
 	return 0;
Kamil Dudka 143732
     }
Kamil Dudka 143732
-- 
Kamil Dudka 143732
2.20.1
Kamil Dudka 143732
Kamil Dudka 143732
Kamil Dudka 143732
From 10dedc96ce0de43372add239f8256e259ca1e04a Mon Sep 17 00:00:00 2001
Kamil Dudka 143732
From: Kamil Dudka <kdudka@redhat.com>
Kamil Dudka 143732
Date: Fri, 26 Jul 2019 17:24:59 +0200
Kamil Dudka 143732
Subject: [PATCH 2/2] 44582: Fix foregoing commit to use DPUTS() better
Kamil Dudka 143732
Kamil Dudka 143732
Upstream-commit: d6a9e222ec6b006c09d6f84beae6ef488a19b214
Kamil Dudka 143732
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
Kamil Dudka 143732
---
Kamil Dudka 143732
 Src/Zle/zle_utils.c | 10 ++++------
Kamil Dudka 143732
 1 file changed, 4 insertions(+), 6 deletions(-)
Kamil Dudka 143732
Kamil Dudka 143732
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
Kamil Dudka 143732
index 633f593..29dba08 100644
Kamil Dudka 143732
--- a/Src/Zle/zle_utils.c
Kamil Dudka 143732
+++ b/Src/Zle/zle_utils.c
Kamil Dudka 143732
@@ -1608,10 +1608,9 @@ unapplychange(struct change *ch)
Kamil Dudka 143732
 {
Kamil Dudka 143732
     if(ch->hist != histline) {
Kamil Dudka 143732
 	Histent he = quietgethist(ch->hist);
Kamil Dudka 143732
-	if(!he) {
Kamil Dudka 143732
-	    dputs(ERRMSG("quietgethist(ch->hist) returned NULL"));
Kamil Dudka 143732
+	DPUTS(he == NULL, "quietgethist(ch->hist) returned NULL");
Kamil Dudka 143732
+	if(he == NULL)
Kamil Dudka 143732
 	    return 1;
Kamil Dudka 143732
-	}
Kamil Dudka 143732
 	zle_setline(he);
Kamil Dudka 143732
 	zlecs = ch->new_cs;
Kamil Dudka 143732
 	return 0;
Kamil Dudka 143732
@@ -1653,10 +1652,9 @@ applychange(struct change *ch)
Kamil Dudka 143732
 {
Kamil Dudka 143732
     if(ch->hist != histline) {
Kamil Dudka 143732
 	Histent he = quietgethist(ch->hist);
Kamil Dudka 143732
-	if(!he) {
Kamil Dudka 143732
-	    dputs(ERRMSG("quietgethist(ch->hist) returned NULL"));
Kamil Dudka 143732
+	DPUTS(he == NULL, "quietgethist(ch->hist) returned NULL");
Kamil Dudka 143732
+	if(he == NULL)
Kamil Dudka 143732
 	    return 1;
Kamil Dudka 143732
-	}
Kamil Dudka 143732
 	zle_setline(he);
Kamil Dudka 143732
 	zlecs = ch->old_cs;
Kamil Dudka 143732
 	return 0;
Kamil Dudka 143732
-- 
Kamil Dudka 143732
2.20.1
Kamil Dudka 143732