TypeCobol icon indicating copy to clipboard operation
TypeCobol copied to clipboard

FormatException in string.Format due to user input containing place holders

Open efr15 opened this issue 4 months ago • 1 comments

Describe the bug

For instance, a diagnostic is created because a VALUE assigned to a data is too big compared to the data declaration. The diagnostic mentions the value itself. It may contain some braces which are considered by string.Format as place holders (and thus leads to a FormatException).

Technical The place holders should be escaped in the user input. In Diagnostic constructor, a string.Format is possibly vulnerable when called by Violation sub-class. Fix: the message should be escaped in method Violation.ToDiagnosticMessage.

But all string.Format usages should be checked.

How to test automatically Write new tests reproducing the problems

efr15 avatar Oct 11 '24 09:10 efr15