Open
Description
I imagine the standard Checked C signature for main
should be something like:
int main(int argc, _Nt_array_ptr<_Nt_array_ptr<char>> argv : count(argc));
(And maybe add an environ
parameter too?) But the compiler does not enforce this: it seems to accept any signature with the correct unchecked type, including one with a bogus bound for argv
. The following code compiles with no warnings and gives me a segmentation fault at runtime:
#pragma CHECKED_SCOPE on
const int bogus_count = 100000000;
int main(int argc, _Nt_array_ptr<_Nt_array_ptr<char>> argv : count(bogus_count)) {
for (int i = 0; i < bogus_count; i++) {
argv[i] = 0;
}
return 0;
}