This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] avoid GDB crash on inspection of pascal arrays


  The is_pascal_string_type function in p-lang.c 
could sometimes be called with an type parameter being NULL.
  This caused crashes in the Free Pascal IDE,
that I finally debugged recently.

  Checked in as pascal language maintainer,

Pierre Muller



ChangeLog entry:

2020-03-08  Pierre Muller  <muller@ics.u-strasbg.fr>

       * p-lang.c (is_pascal_string_type): Check that TYPE arg is non NULL.



Index: p-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/p-lang.c,v
retrieving revision 1.50
diff -u -p -r1.50 p-lang.c
--- p-lang.c    14 Jan 2010 08:03:36 -0000      1.50
+++ p-lang.c    8 Mar 2010 16:49:20 -0000
@@ -101,7 +101,7 @@ is_pascal_string_type (struct type *type
                       struct type **char_type,
                       char **arrayname)
 {
-  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+  if ((type != NULL) && (TYPE_CODE (type) == TYPE_CODE_STRUCT))
     {
       /* Old Borland type pascal strings from Free Pascal Compiler.  */
       /* Two fields: length and st.  */
 2010-03-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
            Hui Zhu  <teawater@gmail.com>




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]