diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-02-21 14:01:51 +0100 |
---|---|---|
committer | Bernhard Schommer <bernhardschommer@gmail.com> | 2017-02-21 14:01:51 +0100 |
commit | 1e867c804ed11200c8ed1a55a71f416977249363 (patch) | |
tree | f2acbb3d45d27b403840ef35b38b0159285f2ab6 /cparser/Elab.ml | |
parent | a83df40c59f8b3c50581304fb6c0d3913acf15c7 (diff) | |
download | compcert-1e867c804ed11200c8ed1a55a71f416977249363.tar.gz compcert-1e867c804ed11200c8ed1a55a71f416977249363.zip |
Added check for large arrays.
The check tests whether the size calculation of an array overflows
or the array covers half of the available address space and reports
an error in this case.
Bug 21034
Diffstat (limited to 'cparser/Elab.ml')
-rw-r--r-- | cparser/Elab.ml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 07351c46..8b38f4c7 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -658,6 +658,7 @@ and elab_type_declarator keep_ty loc env ty kr_ok = function if n < 0L then error loc "size of array is negative"; if n = 0L then warning loc Zero_length_array "zero size arrays are an extension"; + if not (Cutil.valid_array_size env ty n) then error loc "size of array is too large"; Some n | None -> error loc "size of array is not a compile-time constant"; |