From ae4305da91a315c858ca9491101ebd1a4706763e Mon Sep 17 00:00:00 2001 From: Yun Hsiao Wu Date: Mon, 26 Jul 2021 16:21:12 +0800 Subject: [PATCH] Fix per-set argument parsing in standalone --- StandAlone/StandAlone.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp index c6dc5974..e62f92f7 100644 --- a/StandAlone/StandAlone.cpp +++ b/StandAlone/StandAlone.cpp @@ -347,13 +347,13 @@ void ProcessBindingBase(int& argc, char**& argv, glslang::TResourceType res) lang = FindLanguage(argv[arg++], false); } - if ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) { + if ((argc - arg) >= 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) { // Parse a per-set binding base - while ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) { + do { const int baseNum = atoi(argv[arg++]); const int setNum = atoi(argv[arg++]); perSetBase[setNum] = baseNum; - } + } while ((argc - arg) >= 2 && isdigit(argv[arg + 0][0]) && isdigit(argv[arg + 1][0])); } else { // Parse single binding base singleBase = atoi(argv[arg++]);