From 2dbfed05322bde0703c2a8a841c8a90174120454 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 May 2026 09:09:21 -0700 Subject: [PATCH] display_tty_menu_item eassert for absurdly long item texts * src/xdisp.c (display_tty_menu_item): Add an eassert. --- src/xdisp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xdisp.c b/src/xdisp.c index c1d6fedb553..b00a4b2e1e7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27922,6 +27922,11 @@ display_tty_menu_item (const char *item_text, int width, int face_id, struct glyph_row *row; size_t item_len = strlen (item_text); + /* FIXME: callers do not seem to guarantee that the length is sane. + If it gets close to or greater than INT_MAX, things will go squirrelly. + Also, shouldn't this use menu_item_width rather than strlen? */ + eassert (item_len <= INT_MAX / 2); + struct frame *rf = NULL; if (FRAME_PARENT_FRAME (f) && !FRAME_WINDOW_P (f)