git: a711add6ceff - stable/12 - Fix another UBSan error in awk

Warner Losh imp at FreeBSD.org
Sat Jul 10 17:12:58 UTC 2021


The branch stable/12 has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a711add6ceffc58dabb930a0fdd685ddbac7b83c

commit a711add6ceffc58dabb930a0fdd685ddbac7b83c
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2020-09-21 19:03:12 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-07-10 17:11:15 +0000

    Fix another UBSan error in awk
    
    This applies my upstreamed fix: https://github.com/onetrueawk/awk/commit/ad9bd2f40a89ec9533b92254b86a756cf4f40fd4
    Found By:       UBSan
    
    (cherry picked from commit 1116946093d537569a29692a6a86de59cd49384e)
---
 contrib/one-true-awk/lex.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/contrib/one-true-awk/lex.c b/contrib/one-true-awk/lex.c
index 8e689f1a682a..e537df4151da 100644
--- a/contrib/one-true-awk/lex.c
+++ b/contrib/one-true-awk/lex.c
@@ -467,9 +467,8 @@ int word(char *w)
 	int c, n;
 
 	n = binsearch(w, keywords, sizeof(keywords)/sizeof(keywords[0]));
-/* BUG: this ought to be inside the if; in theory could fault (daniel barrett) */
-	kp = keywords + n;
 	if (n != -1) {	/* found in table */
+		kp = keywords + n;
 		yylval.i = kp->sub;
 		switch (kp->type) {	/* special handling */
 		case BLTIN:


More information about the dev-commits-src-branches mailing list