<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Ticket search results</title><link>https://forge.codesys.com/lib/counit/tickets/</link><description>You searched for assigned_to:"i-campbell"</description><language>en</language><lastBuildDate>Tue, 10 Aug 2021 01:56:43 -0000</lastBuildDate><item><title>Assert_Equals() with STRING(1024) Causes PLC Crash</title><link>https://forge.codesys.com/lib/counit/tickets/39/</link><description>**Test version: **v1.0.9.9 RC2
**Problem: **Using Assert_Equals() with STRING(1024) Causes PLC to crash.
The problem is, the AssertEquals uses pointers to write to memory, and will happily copy an entire 1024 character string over the top of a 255 character string
See screenshot for the line which causes the memory overwrite
**Steps to repeat: **
With the Verifier_MultiCycle_Examplev1.0.9.9.project, change the following POU:
Test/FB_AnyPrimitiveTypes.Test_ANY_STRING_Equals
to
~~~ST
METHOD PRIVATE Test_ANY_STRING_Equals
VAR
    a : STRING(1024) := 'WCPRZC2VAB
01SQ7HD707
68UUBLAN0H
AI2HPVN8YO
NQ5T9PIV9M
DAQYA96Y8T';
    b : STRING(1024) := 'WCPRZC2VAB
01SQ7HD707
68UUBLAN0H
AI2HPVN8YO
NQ5T9PIV9M
DAQYA96Y8T';
END_VAR
~~~
~~~ST
TEST('Test_ANY_STRING_Equals');

AssertEquals(Expected := a,
             Actual := b,
             Message := 'Values differ');

TEST_FINISHED();
~~~
Download to the PLC and run
==&gt; IS: PLC stops unexpectedly, no logs written, PLC won't start again
==&gt; SHOULD: Either allow to compare any length strings, OR don't allow them and print an error message rather than crashing the PLC
Note: To recover, delete the application from the PLC, for example at C:\ProgramData\CODESYS\CODESYSControlWinV3x64\AAAA\PlcLogic\Application\</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">i-campbell</dc:creator><pubDate>Tue, 10 Aug 2021 01:56:43 -0000</pubDate><guid isPermaLink="false">https://forge.codesys.com/lib/counit/tickets/39/</guid></item></channel></rss>