-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(W)STRING over 255 causes memory overwrite and page fault with AsssertEquals or is silently truncated by AssertEquals_(W)String #112
Comments
You're right, this should be handled. I would say you actually found two things here:
If we stick to only supporting 255 chars for now, the user should be notified that strings longer than 255 are not supported in both cases. |
Yes, a VAR_INPUT STRING(255) will truncate any string bigger than 255 that is passed to it. May I take on as a first 'code' issue, implementing unlimited length strings/wstrings? I would need either VAR_IN_OUT CONSTANT STRING(16#7FFF_FFFE) or ANY_STRING or POINTER TO STRING
|
I don't think
I'll just quickly note that there is a collection of slightly more obscure string functions in the Beckhoff libraries which support strings > 255 characters, unlike the standard functions, eg |
Another alternative is to simply add another assertion-function specific for strings > 255 chars, as to not brake current usage (basically the same way we have CONCAT and CONCAT2). The ANY-variant should handle > 255 chars, as it anyway already is using pointers (the ANY-type). |
With the current implementation, using a STRING or WSTRING with size over 255 with AssertEquals will overwrite memory, hopefully leading to an access violation.
TcUnit should not overwrite memory. Errors should be reported if unsuported input is used.
This could be solved by:
TcUnit/TcUnit/TcUnit/POUs/FB_TestSuite.TcPOU
Line 2455 in 13276ed
The following code shows the error:
The text was updated successfully, but these errors were encountered: