From 65e811570be17411e6c1996e2e3a8d5c1707a4ae Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 28 Aug 2026 08:02:16 +0000 Subject: [PATCH 1/2] Do no free input context if it is NULL when popup create fails. --- popup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/popup.c b/popup.c index 5e037922f..8dd058d57 100644 --- a/popup.c +++ b/popup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popup.c,v 1.76 2026/07/14 19:07:03 nicm Exp $ */ +/* $OpenBSD: popup.c,v 1.77 2026/08/28 08:02:16 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott @@ -80,7 +80,8 @@ popup_free(struct popup_data *pd) if (pd->job != NULL) job_free(pd->job); - input_free(pd->ictx); + if (pd->ictx != NULL) + input_free(pd->ictx); free(pd->r.ranges); screen_free(&pd->s); From 7bad4f772208e1c78de0ad422c7638d7fcf74c4c Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 28 Aug 2026 08:11:08 +0000 Subject: [PATCH 2/2] Do not walk off end of grid lines if last line is wrapped, reported by Moe Khalilov. --- grid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grid.c b/grid.c index ba1bb8730..6ab58eb62 100644 --- a/grid.c +++ b/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.156 2026/08/03 12:58:53 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.157 2026/08/28 08:11:08 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -1584,7 +1584,7 @@ grid_wrap_position(struct grid *gd, u_int px, u_int py, u_int *wx, u_int *wy) void grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) { - u_int yy, ay = 0; + u_int yy, ay = 0, ey = gd->hsize + gd->sy - 1; for (yy = 0; yy < gd->hsize + gd->sy - 1; yy++) { if (ay == wy) @@ -1598,7 +1598,7 @@ grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) * until we find the end or the line now containing wx. */ if (wx == UINT_MAX) { - while (gd->linedata[yy].flags & GRID_LINE_WRAPPED) + while (yy < ey && gd->linedata[yy].flags & GRID_LINE_WRAPPED) yy++; wx = gd->linedata[yy].cellused; } else {