From ea40e3c5ce946583369749843ad134c3cb607fc7 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sat, 4 May 2013 23:59:52 +0000 Subject: [PATCH] ncurses 5.9 - patch 20130504 + fixes for issues found by Coverity: + correct FNKEY() macro in progs/dump_entry.c, allowing kf11-kf63 to display when infocmp's -R option is used for HP or AIX subsets. + fix dead-code issue with test/movewindow.c + improve limited-checking in _nc_read_termtype(). --- NEWS | 13 +++++++-- dist.mk | 4 +-- ncurses/tinfo/read_entry.c | 14 +++++----- package/debian/changelog | 4 +-- package/ncurses.spec | 2 +- progs/dump_entry.c | 8 ++++-- test/movewindow.c | 56 ++++++++++++++++++-------------------- 7 files changed, 55 insertions(+), 46 deletions(-) diff --git a/NEWS b/NEWS index 9f7b3888..84da50c7 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2049 2013/04/27 21:56:59 tom Exp $ +-- $Id: NEWS,v 1.2053 2013/05/04 23:03:37 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,13 @@ 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. +20130504 + + fixes for issues found by Coverity: + + correct FNKEY() macro in progs/dump_entry.c, allowing kf11-kf63 to + display when infocmp's -R option is used for HP or AIX subsets. + + fix dead-code issue with test/movewindow.c + + improve limited-checking in _nc_read_termtype(). + 20130427 + fix clang 3.2 warning in progs/dump_entry.c + drop AC_TYPE_SIGNAL check; ncurses relies on c89 and later. @@ -2706,7 +2713,7 @@ it is not possible to add this information. + modify configure script to quiet c++ build with libtool when the --disable-echo option is used. + modify configure script to disable ada95 if libtool is selected, - writing a warning message (addresses FreeBSD ports/114493). + writing a warning message (addresses FreeBSD #114493). + update config.guess, config.sub 20070707 @@ -5272,7 +5279,7 @@ it is not possible to add this information. + modify lib_screen.c and lib_newwin.c to maintain the SCREEN-specific pointers for curscr/stdscr/newscr when scr_save() and scr_restore() modify the global curscr/stdscr/newscr variables. Fixes Redhat - #68199 dated 2002-07-07. + #68199. + add checks for null pointer in calls to tparm() and tgoto() based on FreeBSD bug report. If ncurses were built with termcap support, and the first call to tgoto() were a zero-length string, the result would diff --git a/dist.mk b/dist.mk index 4dea8d18..28e3c60c 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.925 2013/04/27 17:52:18 tom Exp $ +# $Id: dist.mk,v 1.926 2013/05/04 14:55:13 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20130427 +NCURSES_PATCH = 20130504 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c index 47852ad1..a74bfd75 100644 --- a/ncurses/tinfo/read_entry.c +++ b/ncurses/tinfo/read_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: read_entry.c,v 1.121 2012/11/18 01:18:47 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.122 2013/05/04 22:53:42 tom Exp $") #define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) @@ -124,7 +124,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit) int offset = 0; int name_size, bool_count, num_count, str_count, str_size; int i; - char buf[MAX_ENTRY_SIZE + 1]; + char buf[MAX_ENTRY_SIZE + 2]; char *string_table; unsigned want, have; @@ -159,7 +159,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit) want = (unsigned) (str_size + name_size + 1); if (str_size) { /* try to allocate space for the string table */ - if (str_count * 2 >= (int) sizeof(buf) + if (str_count * 2 >= MAX_ENTRY_SIZE || (string_table = typeMalloc(char, want)) == 0) { return (TGETENT_NO); } @@ -238,9 +238,9 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit) unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count); int base = 0; - if (need >= sizeof(buf) - || ext_str_size >= (int) sizeof(buf) - || ext_str_limit >= (int) sizeof(buf) + if (need >= (MAX_ENTRY_SIZE / 2) + || ext_str_size >= MAX_ENTRY_SIZE + || ext_str_limit >= MAX_ENTRY_SIZE || ext_bool_count < 0 || ext_num_count < 0 || ext_str_count < 0 diff --git a/package/debian/changelog b/package/debian/changelog index 9a594a96..db1552f2 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (5.9-20130427) unstable; urgency=low +ncurses6 (5.9-20130504) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 20 Apr 2013 09:08:00 -0400 + -- Thomas E. Dickey Sat, 04 May 2013 10:55:57 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/ncurses.spec b/package/ncurses.spec index 96f88eb0..25a13dc5 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Release: 5.9 -Version: 20130427 +Version: 20130504 License: X11 Group: Development/Libraries Source: ncurses-%{release}-%{version}.tgz diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 1fc9a890..241fc1dc 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.108 2013/04/27 21:45:19 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.109 2013/05/04 18:48:56 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -309,7 +309,11 @@ dump_predicate(PredType type, PredIdx idx) static void set_obsolete_termcaps(TERMTYPE *tp); /* is this the index of a function key string? */ -#define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) +#define FNKEY(i) \ + (((i) >= STR_IDX(key_f0) && \ + (i) <= STR_IDX(key_f9)) || \ + ((i) >= STR_IDX(key_f11) && \ + (i) <= STR_IDX(key_f63))) /* * If we configure with a different Caps file, the offsets into the arrays diff --git a/test/movewindow.c b/test/movewindow.c index 612cb882..9effda41 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2006-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.38 2012/12/15 18:36:40 tom Exp $ + * $Id: movewindow.c,v 1.39 2013/05/04 19:41:02 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -494,34 +494,32 @@ move_derwin(WINDOW *win) if (parent != 0) { bool top = (parent == stdscr); - if (!top) { - int min_col = top ? COL_MIN : 0; - int max_col = top ? COL_MAX : getmaxx(parent); - int min_line = top ? LINE_MIN : 0; - int max_line = top ? LINE_MAX : getmaxy(parent); - PAIR *tmp; - bool more; - - show_derwin(win); - while ((tmp = selectcell(parent, - win, - min_line, min_col, - max_line, max_col, - TRUE, - &more)) != 0) { - if (mvderwin(win, tmp->y, tmp->x) != ERR) { - refresh_all(win); - doupdate(); - repaint_one(win); - doupdate(); - result = TRUE; - show_derwin(win); - } else { - flash(); - } - if (!more) - break; + int min_col = top ? COL_MIN : 0; + int max_col = top ? COL_MAX : getmaxx(parent); + int min_line = top ? LINE_MIN : 0; + int max_line = top ? LINE_MAX : getmaxy(parent); + PAIR *tmp; + bool more; + + show_derwin(win); + while ((tmp = selectcell(parent, + win, + min_line, min_col, + max_line, max_col, + TRUE, + &more)) != 0) { + if (mvderwin(win, tmp->y, tmp->x) != ERR) { + refresh_all(win); + doupdate(); + repaint_one(win); + doupdate(); + result = TRUE; + show_derwin(win); + } else { + flash(); } + if (!more) + break; } } head_line("done"); -- 2.44.0