Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 lint: reproduce the crash from ckg...
details: https://anonhg.NetBSD.org/src/rev/6d96471edc05
branches: trunk
changeset: 952870:6d96471edc05
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Feb 20 09:40:42 2021 +0000
description:
lint: reproduce the crash from ckgetopt.c 1.2
The intention of the getopt check was to analyze only those while loops
whose condition consists of the usual getopt call. For all other while
loops, ck.while_level was intended to stay at 0.
This was not the case in ckgetopt.c 1.2 and has been fixed in ckgetopt.c
1.3. The code did not document the intended invariants though, which it
should have done. This will be done in a follow-up commit.
diffstat:
tests/usr.bin/xlint/lint1/msg_338.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r ca244d8bc8f0 -r 6d96471edc05 tests/usr.bin/xlint/lint1/msg_338.c
--- a/tests/usr.bin/xlint/lint1/msg_338.c Sat Feb 20 09:36:30 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_338.c Sat Feb 20 09:40:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_338.c,v 1.1 2021/02/19 12:28:56 rillig Exp $ */
+/* $NetBSD: msg_338.c,v 1.2 2021/02/20 09:40:42 rillig Exp $ */
# 3 "msg_338.c"
// Test for message: option '%c' should be handled in the switch [338]
@@ -41,5 +41,13 @@
}
}
+ /* A while loop that is not related to getopt is simply skipped. */
+ while (o != 0) {
+ switch (o) {
+ case '?':
+ o = ':';
+ }
+ }
+
return 0;
}
Home |
Main Index |
Thread Index |
Old Index