-
Notifications
You must be signed in to change notification settings - Fork 79
Check array literals for null terminators. #397
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
Comments
Prabhuk
added a commit
that referenced
this issue
Jul 12, 2018
#397 Partial commit. Added a call to handle NT_CHECKED initializers. If the type of the declaration requires NT_CHECKED, the last item in the initializer list is validated to make sure it is null (nullptr, NULL, 0 or '\0' depending on what's appropriate). Pending: 1. Handle all types (Constant char arrays are not handled yet.) 2. Tests (Add tests for ptr to NT_CHECKED types, NT_CHECKED array, Struct that contains one or both of the previous two cases) 3. Error handling. The current version of the compiler crashes if the NT_CHECKED array is not null terminated.
This was referenced Jul 17, 2018
Prabhuk
pushed a commit
to checkedc/checkedc
that referenced
this issue
Jul 24, 2018
…#289) Related Issue: checkedc/checkedc-clang#397 1. Added test cases for possible ways through which _Nt_initializers arrays can be initialized 2. Added negative test cases (e.g. array initializers without null terminators at the end) for which checkedc clang compiler is expected to report errors
Prabhuk
pushed a commit
that referenced
this issue
Jul 24, 2018
…#531) Related Issue: #397 Added a function to validate _Nt_checked type array initializers. If the type of the declaration is _Nt_checked, the last item in the initializer list is validated to make sure it is null (nullptr, NULL, 0 or '\0' depending on what's appropriate). If the type of the initializer is a string literal, the size of the initializer string is validated to be within the size of the _Nt_checked array that is initialized. If the type of the initializer is record type (struct, typedef struct, union), has _Nt_checked typed field(s) within the initialized data structure, their initializers are validated as well. Testing: Added checkedc tests for _Nt_checked initializers. Automated tests: DevTest Debug X64 Linux, DevTest Debug x64 Windows, DevTest Debug X86 Windows, DevTest Release Linux X64 LNT
This work item is complete. @Prabhuk, thanks! |
This was referenced Jan 15, 2022
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When an array literal is implicitly converted to a null-terminated array pointer type, we need to check that the array literal has a null terminator.
The text was updated successfully, but these errors were encountered: