Configuration | Rules PROGRAM MAIN VAR_TEMP nIndex : INT; END_VAR VAR aSample : ARRAY[0..10] OF INT; END_VAR FOR nIndex := INT#0 TO INT#50 DO aSample[nIndex] := 0; // => SA0172 END_FOR 4.2.1.7.12 SA0175: Suspicious operation on string | SA0175: Suspicious operation on string This rule can only be checked using the Command 'Run static analysis' [ } 110] command, not using the “Check all objects” option. Samples: VAR sVar : STRING; pVar : POINTER TO STRING; nVar : INT; END_VAR // 1) SA0175: Suspicious operation on string: Index access sVar[2]; // => SA0175 // 2) SA0175: Suspicious operation on string: Possible index access pVar := ADR(sVar); // => SA0175 // 3) SA0175:
Suspicious operation on string: Possible index access nVar := FIND(sVar, 'a'); // => SA0175 // 4) SA0175: Suspicious operation on string: Literal ' ' contains Non-ASCII character sVar := '99€'; // => SA0175 sVar := 'Д'; // => SA0175 TE1200 78 Version: 2.11.1 Function Determines code positions that are suspicious for UTF-8 encoding. Captured constructs 1. Index access to a single-byte string ◦ Sample: sVar[2] ◦ Message: Suspicious operation on string: index access ' ' 2. Address access to a single-byte string ◦ Sample: ADR(sVar) ◦ Message: Suspicious operation on string: Possible index access ' ' 3. Call of a string function of the Tc2 Standard library except CONCAT and LEN _ ◦ Sample:
FIND(sVar, 'a'); ◦ Message: Suspicious operation on string: Possible index access ' ' 4. Single byte literal containing non-ASCII characters ◦ Samples: sVar := '99€'; sVar := 'Ä'; ◦ Message: Suspicious operation on string: literal ' ' contains non-ASCII characters Importance Medium