Hello-

Happened to notice this minor issue that seems worth fixing. bootstrap +
regtest on x86-64, is it OK please? Thanks!

-Lewis

-- >8 --

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.
---
 libcpp/macro.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libcpp/macro.cc b/libcpp/macro.cc
index 0b8eebee061..66c0bb03145 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);
 }
 

Reply via email to