Added some securities in ARB resolveParam
@@ -940,16 +940,15 @@ char **resolveParam(sCurStatus_NewVar *newVar, int vertex, int type) {
if (newVar->strParts[0][0] == '[') {
free(popFIFO((sArray*)newVar));
tok = popFIFO((sArray*)newVar);
- if ((tok[0] >= '0') && (tok[0] <= '9')) {
for (char *numPtr = tok; *numPtr; ++numPtr) {
- ++mvmtxsz;
- mvmtx = mvmtx * 10 + *numPtr - '0';
- }
- } else {
+ if ((*numPtr < '0') || (*numPtr > '9')) {
ARBCONV_DBG_RE("Failed to get param: state.modelview[(NaN)\n")
free(tok);
return NULL;
}
+ ++mvmtxsz;
+ mvmtx = mvmtx * 10 + *numPtr - '0';
+ }
free(tok);
tok = popFIFO((sArray*)newVar);
@@ -966,7 +965,7 @@ char **resolveParam(sCurStatus_NewVar *newVar, int vertex, int type) {
}
}
- if (!newVar->strLen) {
+ if (!newVar->strLen || IS_NEW_STR_OR_SWIZZLE(newVar->strParts[0], type)) {
matrixName = "gl_ModelViewMatrixTranspose";
mtxNameLen = 27;
} else if (!strcmp(newVar->strParts[0], "invtrans")) {
@@ -1118,7 +1117,7 @@ char **resolveParam(sCurStatus_NewVar *newVar, int vertex, int type) {
free(tok);
}
- if (!newVar->strLen) {
+ if (!newVar->strLen || IS_NEW_STR_OR_SWIZZLE(newVar->strParts[0], type)) {
matrixName = "gl_TextureMatrixTranspose";
mtxNameLen = 25;
} else if (!strcmp(newVar->strParts[0], "invtrans")) {
