Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
The IsAsciiCharacter predicate has a template type for its input parameter but it only checks if the value is less than 128. This check is unbounded in its lower bound, so it is prone to receive non-ASCII characters (negative value) and return true. There are three solutions in order of my preference:
- Remove the template and make the type uint8_t. All its use cases use uint8_t and this is the type used across the ASCII operations. Also, the other string-related utility functions are not templates.
- Constrain the template so that it only accepts unsigned integers.
- Add a check to validate that argument is non-negative. This check adds unnecessary overhead.
Attachments
Issue Links
- links to