From 7723dd6799ab10b32047ec73b14df9f107bafe99 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 25 Apr 2023 00:03:30 +0000 Subject: [PATCH] ncurses 6.4 - patch 20230424 + check return value of _nc_save_str(), in special case for tic where extended capabilities are processed but the terminal description was not initialized (report by Ziqiao Kong). + regenerate llib-* files. --- NEWS | 8 +++++++- VERSION | 2 +- dist.mk | 4 ++-- ncurses/llib-lncurses | 17 ++++++++++++++++- ncurses/llib-lncursest | 17 ++++++++++++++++- ncurses/llib-lncursestw | 17 ++++++++++++++++- ncurses/llib-lncursesw | 17 ++++++++++++++++- ncurses/llib-ltinfo | 17 ++++++++++++++++- ncurses/llib-ltinfot | 17 ++++++++++++++++- ncurses/llib-ltinfotw | 17 ++++++++++++++++- ncurses/llib-ltinfow | 17 ++++++++++++++++- ncurses/tinfo/parse_entry.c | 27 ++++++++++++++++++--------- package/debian-mingw/changelog | 4 ++-- package/debian-mingw64/changelog | 4 ++-- package/debian/changelog | 4 ++-- package/mingw-ncurses.nsi | 4 ++-- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- test/README | 18 ++++++++++-------- 20 files changed, 177 insertions(+), 40 deletions(-) diff --git a/NEWS b/NEWS index 549857d2..c4d2ccac 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3944 2023/04/23 21:11:05 tom Exp $ +-- $Id: NEWS,v 1.3945 2023/04/24 22:48:50 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,12 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20230424 + + check return value of _nc_save_str(), in special case for tic where + extended capabilities are processed but the terminal description was + not initialized (report by Ziqiao Kong). + + regenerate llib-* files. + 20230423 + add tiscan_s() to help applications check formatting capabilities that would be passed to tiparm_s, etc. diff --git a/VERSION b/VERSION index 36526f0b..32a99945 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.4 20230423 +5:0:10 6.4 20230424 diff --git a/dist.mk b/dist.mk index 9968b9c5..683355a1 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1539 2023/04/23 15:57:14 tom Exp $ +# $Id: dist.mk,v 1.1540 2023/04/24 22:49:54 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -38,7 +38,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 4 -NCURSES_PATCH = 20230423 +NCURSES_PATCH = 20230424 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses index 211cf3b7..619e15c7 100644 --- a/ncurses/llib-lncurses +++ b/ncurses/llib-lncurses @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2023 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -3656,6 +3656,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-lncursest b/ncurses/llib-lncursest index 1b09d676..64ebbe14 100644 --- a/ncurses/llib-lncursest +++ b/ncurses/llib-lncursest @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019,2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2023 Thomas E. Dickey * * Copyright 2008-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -3741,6 +3741,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-lncursestw b/ncurses/llib-lncursestw index 4576e0fc..1f3b0e4f 100644 --- a/ncurses/llib-lncursestw +++ b/ncurses/llib-lncursestw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2022,2023 Thomas E. Dickey * * Copyright 2009-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -4702,6 +4702,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw index 127350d2..f1a10b89 100644 --- a/ncurses/llib-lncursesw +++ b/ncurses/llib-lncursesw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2022,2023 Thomas E. Dickey * * Copyright 2001-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -4617,6 +4617,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-ltinfo b/ncurses/llib-ltinfo index a5cd7cd3..a25f417e 100644 --- a/ncurses/llib-ltinfo +++ b/ncurses/llib-ltinfo @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2023 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -927,6 +927,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-ltinfot b/ncurses/llib-ltinfot index bd3de812..0cefd7e3 100644 --- a/ncurses/llib-ltinfot +++ b/ncurses/llib-ltinfot @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2021,2022 Thomas E. Dickey * + * Copyright 2019-2022,2023 Thomas E. Dickey * * Copyright 2013-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1003,6 +1003,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-ltinfotw b/ncurses/llib-ltinfotw index 4d35a1e1..1061bf36 100644 --- a/ncurses/llib-ltinfotw +++ b/ncurses/llib-ltinfotw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2022,2023 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -1025,6 +1025,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/llib-ltinfow b/ncurses/llib-ltinfow index db846764..2819bb9c 100644 --- a/ncurses/llib-ltinfow +++ b/ncurses/llib-ltinfow @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2022,2023 Thomas E. Dickey * * Copyright 2012-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -949,6 +949,21 @@ char *tiparm( ...) { return(*(char **)0); } +#undef tiparm_s +char *tiparm_s( + int num_expected, + int tparm_type, + const char *string, + ...) + { return(*(char **)0); } + +#undef tiscan_s +int tiscan_s( + int *num_expected, + int *tparm_type, + const char *string) + { return(*(int *)0); } + #undef _nc_tiparm char *_nc_tiparm( int expected, diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index 14bcb67e..13fef495 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2018-2022,2023 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.107 2022/05/08 00:11:44 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.108 2023/04/24 22:32:33 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -110,7 +110,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) /* Well, we are given a cancel for a name that we don't recognize */ return _nc_extend_names(entryp, name, STRING); default: - return 0; + return NULL; } /* Adjust the 'offset' (insertion-point) to keep the lists of extended @@ -142,6 +142,11 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) for (last = (unsigned) (max - 1); last > tindex; last--) if (!found) { + char *saved; + + if ((saved = _nc_save_str(name)) == NULL) + return NULL; + switch (token_type) { case BOOLEAN: tp->ext_Booleans++; @@ -169,7 +174,7 @@ _nc_extend_names(ENTRY * entryp, const char *name, int token_type) TYPE_REALLOC(char *, actual, tp->ext_Names); while (--actual > offset) tp->ext_Names[actual] = tp->ext_Names[actual - 1]; - tp->ext_Names[offset] = _nc_save_str(name); + tp->ext_Names[offset] = saved; } temp.nte_name = tp->ext_Names[offset]; @@ -364,6 +369,8 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) bool is_use = (strcmp(_nc_curr_token.tk_name, "use") == 0); bool is_tc = !is_use && (strcmp(_nc_curr_token.tk_name, "tc") == 0); if (is_use || is_tc) { + char *saved; + if (!VALID_STRING(_nc_curr_token.tk_valstring) || _nc_curr_token.tk_valstring[0] == '\0') { _nc_warning("missing name for use-clause"); @@ -377,11 +384,13 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) _nc_curr_token.tk_valstring); continue; } - entryp->uses[entryp->nuses].name = _nc_save_str(_nc_curr_token.tk_valstring); - entryp->uses[entryp->nuses].line = _nc_curr_line; - entryp->nuses++; - if (entryp->nuses > 1 && is_tc) { - BAD_TC_USAGE + if ((saved = _nc_save_str(_nc_curr_token.tk_valstring)) != NULL) { + entryp->uses[entryp->nuses].name = saved; + entryp->uses[entryp->nuses].line = _nc_curr_line; + entryp->nuses++; + if (entryp->nuses > 1 && is_tc) { + BAD_TC_USAGE + } } } else { /* normal token lookup */ diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index b617c29a..621fe2e1 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230423) unstable; urgency=low +ncurses6 (6.4+20230424) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 23 Apr 2023 11:57:14 -0400 + -- Thomas E. Dickey Mon, 24 Apr 2023 03:48:00 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index b617c29a..621fe2e1 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230423) unstable; urgency=low +ncurses6 (6.4+20230424) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 23 Apr 2023 11:57:14 -0400 + -- Thomas E. Dickey Mon, 24 Apr 2023 03:48:00 -0400 ncurses6 (5.9+20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index d84b865d..6c9806d8 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.4+20230423) unstable; urgency=low +ncurses6 (6.4+20230424) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sun, 23 Apr 2023 11:57:14 -0400 + -- Thomas E. Dickey Mon, 24 Apr 2023 03:48:00 -0400 ncurses6 (5.9+20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 36f606a1..179aff54 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.579 2023/04/23 15:57:14 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.580 2023/04/24 07:48:00 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "4" !define VERSION_YYYY "2023" -!define VERSION_MMDD "0423" +!define VERSION_MMDD "0424" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 63becfbe..2dcca8bc 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.4 -Release: 20230423 +Release: 20230424 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncurses.spec b/package/ncurses.spec index 105db250..1c72cc53 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.4 -Release: 20230423 +Release: 20230424 License: X11 Group: Development/Libraries URL: https://invisible-island.net/ncurses/ diff --git a/package/ncursest.spec b/package/ncursest.spec index 4aa466b4..b5705374 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.4 -Release: 20230423 +Release: 20230424 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/test/README b/test/README index 7844aa7e..134c00f5 100644 --- a/test/README +++ b/test/README @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright 2018-2021,2022 Thomas E. Dickey -- +-- Copyright 2018-2022,2023 Thomas E. Dickey -- -- Copyright 1998-2017,2018 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: README,v 1.77 2022/08/13 23:34:33 tom Exp $ +-- $Id: README,v 1.78 2023/04/24 23:14:45 tom Exp $ ------------------------------------------------------------------------------- The programs in this directory are used to test and demonstrate ncurses. @@ -296,8 +296,8 @@ cur_term test: demo_termcap demo_terminfo dots dots_mvcur filter list_keys lrt curs_set test: demo_new_pair echochar firework gdc hanoi lrtest ncurses newdemo picsmap rain savescreen tclock testcurs worm xmas curs_set_sp test: sp_tinfo curscr test: demo_panels knight lrtest ncurses popup_msg savescreen tclock -curses_trace test: demo_menus hashtest lrtest ncurses padview redraw test_sgr test_termattrs test_vid_puts test_vidputs testcurs view worm -curses_version test: ncurses progs: clear infocmp tabs tic toe tput tset +curses_trace test: demo_menus hashtest lrtest ncurses padview redraw test_sgr test_termattrs test_vid_puts test_vidputs testcurs view worm progs: infocmp tic toe +curses_version test: back_ground background blue bs cardfile chgat clip_printw color_content color_set combine demo_altkeys demo_defkey demo_forms demo_keyok demo_menus demo_new_pair demo_panels demo_tabs demo_termcap demo_terminfo ditto dots dots_curses dots_mvcur dots_termcap dots_xcurses dup_field echochar extended_color filter firework firstlast foldkeys form_driver_w gdc hanoi hashtest inch_wide inchs ins_wide insdelln inserts key_names keynames knight list_keys lrtest move_field movewindow ncurses newdemo padview pair_content picsmap railroad rain redraw savescreen sp_tinfo tclock test_add_wchstr test_addchstr test_addstr test_addwstr test_arrays test_delwin test_get_wstr test_getstr test_instr test_inwstr test_mouse test_opaque test_setupterm test_sgr test_termattrs test_tparm test_unget_wch test_vid_puts test_vidputs testaddch testcurs testscanw view worm xmas progs: clear infocmp tabs tic toe tput tset def_prog_mode test: bs ncurses def_prog_mode_sp test: sp_tinfo def_shell_mode - @@ -543,7 +543,7 @@ mvwprintw test: demo_menus demo_panels inch_wide inchs ncurses test_delwin tes mvwscanw test: testcurs mvwvline test: ins_wide inserts movewindow ncurses test_add_wchstr test_addchstr test_addstr test_addwstr mvwvline_set - -napms test: demo_panels ditto dots dots_curses dots_mvcur dots_xcurses echochar extended_color firework firstlast gdc hanoi lrtest ncurses padview picsmap railroad rain tclock test_opaque testcurs view worm xmas progs: tset +napms test: demo_panels ditto dots dots_curses dots_mvcur dots_termcap dots_xcurses echochar extended_color firework firstlast gdc hanoi lrtest ncurses padview picsmap railroad rain tclock test_opaque testcurs view worm xmas progs: tset napms_sp test: sp_tinfo new_prescr test: sp_tinfo newpad test: ncurses padview popup_msg testcurs @@ -686,7 +686,7 @@ tgetnum test: demo_termcap dots_termcap railroad tgetnum_sp test: sp_tinfo tgetstr test: demo_termcap dots_termcap railroad tgetstr_sp test: sp_tinfo -tgoto test: dots_termcap railroad progs: tic +tgoto test: dots_termcap railroad test_mouse progs: tic tigetflag test: demo_terminfo savescreen progs: tic tput tigetflag_sp test: sp_tinfo tigetnum test: demo_tabs demo_terminfo dots dots_mvcur ncurses savescreen progs: tput @@ -694,10 +694,12 @@ tigetnum_sp test: sp_tinfo tigetstr test: blue demo_defkey demo_new_pair demo_terminfo foldkeys list_keys savescreen test_mouse test_sgr test_tparm testcurs progs: clear_cmd tic tput tigetstr_sp test: sp_tinfo timeout test: filter rain savescreen -tiparm - +tiparm test: test_tparm +tiparm_s test: test_tparm +tiscan_s test: test_tparm touchline test: chgat clip_printw insdelln touchwin test: chgat clip_printw demo_menus filter firstlast inch_wide inchs ins_wide insdelln inserts movewindow ncurses popup_msg redraw test_add_wchstr test_addchstr test_addstr test_addwstr test_delwin test_get_wstr test_getstr test_instr test_inwstr test_opaque xmas -tparm test: dots dots_mvcur test_mouse test_sgr test_tparm progs: tic tput +tparm test: dots dots_mvcur test_sgr progs: tic tput tputs test: dots dots_mvcur dots_termcap railroad test_tparm test_vid_puts test_vidputs progs: clear_cmd reset_cmd tabs tputs_sp test: sp_tinfo trace - -- 2.45.0