From 7b31d6a05357953c035e2ab05ec117ef748f7798 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 12:40:44 +0300 Subject: Reject a scrollback above TERM_SCROLLBACK_MAX term_new() silently cut a scrollback above 1000000 lines to 1000000. The limit now has a name in term.h, and term_new() returns NULL above it, as it does for the other invalid options. Co-Authored-By: Claude Opus 5.5 --- tests/api_args_test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/api_args_test.c') diff --git a/tests/api_args_test.c b/tests/api_args_test.c index 18af728..6c7dfc7 100644 --- a/tests/api_args_test.c +++ b/tests/api_args_test.c @@ -74,6 +74,16 @@ static void test_new_rejects_bad_options(void) opt.scrollback = -1; assert(!term_new(&opt)); + memset(&opt, 0, sizeof(opt)); + opt.scrollback = TERM_SCROLLBACK_MAX + 1; + assert(!term_new(&opt)); + + memset(&opt, 0, sizeof(opt)); + opt.scrollback = TERM_SCROLLBACK_MAX; + struct term *max = term_new(&opt); + assert(max); + term_free(max); + memset(&opt, 0, sizeof(opt)); opt.cursor_style = (enum term_cursor_style)3; assert(!term_new(&opt)); -- cgit v1.2.3