From d09b6baa1ebc7205c5d7b31e08c4551322322ed7 Mon Sep 17 00:00:00 2001 From: solstice0 Date: Mon, 17 Nov 2025 19:36:31 -0600 Subject: [PATCH] Fix frag shader parser bug --- tools/cgcomp/source/fpparser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/cgcomp/source/fpparser.cpp b/tools/cgcomp/source/fpparser.cpp index 0f3848bc..0745be13 100644 --- a/tools/cgcomp/source/fpparser.cpp +++ b/tools/cgcomp/source/fpparser.cpp @@ -497,11 +497,15 @@ const char* CFPParser::ParseOutputRegAlias(const char *token,s32 *reg,u8 *is_fp1 size_t tlen = strlen(token); // cut off the dst mask for comparison - for (u32 i=0;i < tlen && token[i] != '.';i++, len++) ; + while ((len < it->alias.size() && len < tlen) && // Bounds check + (token[len] != '.' && token[len] != '(' && token[len] != '\0')) { // Delimiter check + len++; + } + if(strncmp(token, it->alias.c_str(), len) == 0) { *reg = it->index; *is_fp16 = it->is_fp16; - return (token + it->alias.size()); + return token + len; } } return ParseOutputReg(token,reg,is_fp16);