Module Name: src Committed By: mcf Date: Tue Jun 1 00:59:02 UTC 2021
Modified Files: src/lib/libcurses: newwin.c Log Message: Fix initial line hash calculation for subwindows lp->hash is not initialized at this point. Since the hash is calculated in chunks using __hash_more(), it needs to be initialized to 0 first (just as in doupdate()). Detected with valgrind while running python's test suite when debugging an unrelated issue. ok uwe@ To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/lib/libcurses/newwin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libcurses/newwin.c diff -u src/lib/libcurses/newwin.c:1.59 src/lib/libcurses/newwin.c:1.60 --- src/lib/libcurses/newwin.c:1.59 Sat May 15 11:06:07 2021 +++ src/lib/libcurses/newwin.c Tue Jun 1 00:59:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: newwin.c,v 1.59 2021/05/15 11:06:07 uwe Exp $ */ +/* $NetBSD: newwin.c,v 1.60 2021/06/01 00:59:01 mcf Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94"; #else -__RCSID("$NetBSD: newwin.c,v 1.59 2021/05/15 11:06:07 uwe Exp $"); +__RCSID("$NetBSD: newwin.c,v 1.60 2021/06/01 00:59:01 mcf Exp $"); #endif #endif /* not lint */ @@ -252,6 +252,7 @@ __set_subwin(WINDOW *orig, WINDOW *win) lp->hash = __hash((char *)(void *)lp->line, (size_t)(win->maxx * __LDATASIZE)); #else + lp->hash = 0; for (cp = lp->line, j = 0; j < win->maxx; j++, cp++) { lp->hash = __hash_more( &cp->ch, sizeof( wchar_t ), lp->hash );