diff options
author | Lewis Hyatt <lhyatt@gmail.com> | 2024-10-22 15:23:40 -0400 |
---|---|---|
committer | Lewis Hyatt <lhyatt@gcc.gnu.org> | 2024-12-23 20:24:30 -0500 |
commit | 27af1a14f3a0c897f5da3fc36cd2f9fe5ca4b0ed (patch) | |
tree | 6d3b30414b27e550bf4dd5569183a35b9f4e567d /libcpp | |
parent | 11090da81e49c37fa5f271b0e0f10291eb0971bc (diff) | |
download | gcc-27af1a14f3a0c897f5da3fc36cd2f9fe5ca4b0ed.zip gcc-27af1a14f3a0c897f5da3fc36cd2f9fe5ca4b0ed.tar.gz gcc-27af1a14f3a0c897f5da3fc36cd2f9fe5ca4b0ed.tar.bz2 |
libcpp: Fix overly large buffer allocation
It seems that tokens_buff_new() has always been allocating the virtual
location buffer 4 times larger than intended, and now that location_t is
64-bit, it is 8 times larger. Fixed.
libcpp/ChangeLog:
* macro.cc (tokens_buff_new): Fix length argument to XNEWVEC.
Diffstat (limited to 'libcpp')
-rw-r--r-- | libcpp/macro.cc | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libcpp/macro.cc b/libcpp/macro.cc index 0b8eebe..66c0bb0 100644 --- a/libcpp/macro.cc +++ b/libcpp/macro.cc @@ -2579,10 +2579,8 @@ tokens_buff_new (cpp_reader *pfile, size_t len, location_t **virt_locs) { size_t tokens_size = len * sizeof (cpp_token *); - size_t locs_size = len * sizeof (location_t); - if (virt_locs != NULL) - *virt_locs = XNEWVEC (location_t, locs_size); + *virt_locs = XNEWVEC (location_t, len); return _cpp_get_buff (pfile, tokens_size); } |