* p-lang.c (is_pascal_string_type): Avoid crashes on structures
having fields without names.
This commit is contained in:
parent
f8a5c26697
commit
5c3da5ea2e
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2010-10-14 Pierre Muller <muller@ics.u-strasbg.fr>
|
||||||
|
|
||||||
|
* p-lang.c (is_pascal_string_type): Avoid crashes on structures
|
||||||
|
having fields without names.
|
||||||
|
|
||||||
2010-10-13 Tom Tromey <tromey@redhat.com>
|
2010-10-13 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* language.h (LA_PRINT_ARRAY_INDEX): Fix argument name.
|
* language.h (LA_PRINT_ARRAY_INDEX): Fix argument name.
|
||||||
|
|
|
@ -106,7 +106,9 @@ is_pascal_string_type (struct type *type,int *length_pos,
|
||||||
/* Old Borland type pascal strings from Free Pascal Compiler. */
|
/* Old Borland type pascal strings from Free Pascal Compiler. */
|
||||||
/* Two fields: length and st. */
|
/* Two fields: length and st. */
|
||||||
if (TYPE_NFIELDS (type) == 2
|
if (TYPE_NFIELDS (type) == 2
|
||||||
|
&& TYPE_FIELDS (type) [0].name
|
||||||
&& strcmp (TYPE_FIELDS (type)[0].name, "length") == 0
|
&& strcmp (TYPE_FIELDS (type)[0].name, "length") == 0
|
||||||
|
&& TYPE_FIELDS (type) [1].name
|
||||||
&& strcmp (TYPE_FIELDS (type)[1].name, "st") == 0)
|
&& strcmp (TYPE_FIELDS (type)[1].name, "st") == 0)
|
||||||
{
|
{
|
||||||
if (length_pos)
|
if (length_pos)
|
||||||
|
@ -124,7 +126,9 @@ is_pascal_string_type (struct type *type,int *length_pos,
|
||||||
/* GNU pascal strings. */
|
/* GNU pascal strings. */
|
||||||
/* Three fields: Capacity, length and schema$ or _p_schema. */
|
/* Three fields: Capacity, length and schema$ or _p_schema. */
|
||||||
if (TYPE_NFIELDS (type) == 3
|
if (TYPE_NFIELDS (type) == 3
|
||||||
|
&& TYPE_FIELDS (type) [0].name
|
||||||
&& strcmp (TYPE_FIELDS (type)[0].name, "Capacity") == 0
|
&& strcmp (TYPE_FIELDS (type)[0].name, "Capacity") == 0
|
||||||
|
&& TYPE_FIELDS (type) [1].name
|
||||||
&& strcmp (TYPE_FIELDS (type)[1].name, "length") == 0)
|
&& strcmp (TYPE_FIELDS (type)[1].name, "length") == 0)
|
||||||
{
|
{
|
||||||
if (length_pos)
|
if (length_pos)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue