Only read the right number of bytes in reading basetypes, so we don't
authorJohn Gilmore <gnu@cygnus>
Sat, 3 Aug 1991 02:02:03 +0000 (02:02 +0000)
committerJohn Gilmore <gnu@cygnus>
Sat, 3 Aug 1991 02:02:03 +0000 (02:02 +0000)
overrun malloc.

gdb/ChangeLog
gdb/values.c

index 3217d333e5a3bf0d64fd4e025cc1e04d8b4120d4..f4c1b4f205e1b16c32ac49d9c97cdc9184bc99fd 100644 (file)
@@ -1,5 +1,9 @@
 Fri Aug  2 00:13:06 1991  John Gilmore  (gnu at cygint.cygnus.com)
 
+       * values.c (basetype_addr):  When reading target memory, use the
+       length of the basetype, not the upper type.  We've only malloc'd
+       enough space for the basetype, leading to errors in free().
+
        * expprint.c (print_subexp):  Print UNOP_MEMVAL of an OP_LONG that
        ends up as a function specially, since we know the actual type of
        the pointed-to address.  This (somewhat) fixes display of
index 1c11d4ea4023c01114ebb272cff89b033fd85e13..34c64b3a4d1c87502d4e78cc038fa2fa666b496c 100644 (file)
@@ -1179,7 +1179,7 @@ baseclass_addr (type, index, valaddr, valuep, errp)
 
              status = target_read_memory (addr,
                                           VALUE_CONTENTS_RAW (val),
-                                          TYPE_LENGTH (type));
+                                          TYPE_LENGTH (basetype));
              VALUE_LVAL (val) = lval_memory;
              VALUE_ADDRESS (val) = addr;