Fixes potential segmentation fault in edge cases. (#465)

The options are parsed starting from 1, so check `current < argc`
instead of `!=` in the case that `argc` is zero.
This commit is contained in:
HanaKami 2025-09-19 05:28:21 +08:00 committed by GitHub
parent 80cb4520f7
commit 8df9a4d271
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -2519,7 +2519,7 @@ OptionParser::parse(int argc, const char* const* argv)
std::vector<std::string> unmatched;
while (current != argc)
while (current < argc)
{
if (strcmp(argv[current], "--") == 0)
{