tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] bug fix to struct * segmentation fault


From: Pedro A. Aranda Gutiérrez
Subject: [Tinycc-devel] bug fix to struct * segmentation fault
Date: Fri, 07 Feb 2003 10:36:27 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01

Hi folks,

I had a couple of minutes to dive in the sources and have found
a remedy to the bug I caught a couple of days ago...

With the attached patch, you get an error message instead of
a segmentation fault...

Cheers,
--
Pedro Andrés Aranda Gutiérrez
Telefónica  I+D          IP Network Access Technologies
Consultant                           mailto:address@hidden
C./ Emilio Vargas, 6                Tlf +34-91 337 4702
E-28043 Madrid, Spain               FAX +34-91 337 4502

Fragen sind nicht da, um beantwortet zu werden.
Fragen sind da, um gestellt zu werden  - Georg Kreisler
--- tcc.c       2003-02-07 10:21:41.000000000 +0100
+++ tcc.c.orig  2002-12-30 20:07:52.000000000 +0100
@@ -1555,26 +1555,15 @@
     s->r = r;
     /* don't record fields or anonymous symbols */
     /* XXX: simplify */
-   
     if (!(v & SYM_FIELD) && (v & ~SYM_STRUCT) < SYM_FIRST_ANOM) {
-      /*
-       * PAAG : catch 'struct *pp;' segmentation fault
-       */
-      int table_index = (v & ~SYM_STRUCT) - TOK_IDENT;
-
-      if (table_index < 0) {
-       return NULL;
-      } else {
         /* record symbol in token array */
-        ts = table_ident[table_index];
+        ts = table_ident[(v & ~SYM_STRUCT) - TOK_IDENT];
         if (v & SYM_STRUCT)
             ps = &ts->sym_struct;
         else
             ps = &ts->sym_identifier;
-
         s->prev_tok = *ps;
         *ps = s;
-      }
     }
     return s;
 }
@@ -5866,12 +5855,6 @@
     }
     type1.t = a;
     s = sym_push(v | SYM_STRUCT, &type1, 0, 0);
-    /*
-     * PAAG: catch 'struct *pp;' segmentation fault
-     */
-    if (s == NULL) {
-      error ("parse error before token '%s'",get_tok_str(tok,NULL));
-    }
     /* put struct/union/enum name in type */
  do_decl:
     type->t = u;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]