From b3ec683892479675c378577694ce21fca9561d5f Mon Sep 17 00:00:00 2001 From: HanaKami <94033416+hana-kami@users.noreply.github.com> Date: Tue, 16 Sep 2025 10:07:00 +0800 Subject: [PATCH] Fixes potential segmentation fault in edge cases. Check for null pointer before accessing argv[current] in OptionParser::parse() to handle invalid argument scenarios that can occur with over-processed command line arguments. --- include/cxxopts.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index b969dc2..a5c67f1 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -2519,7 +2519,7 @@ OptionParser::parse(int argc, const char* const* argv) std::vector unmatched; - while (current != argc) + while (current < argc) { if (strcmp(argv[current], "--") == 0) {