such code will let tcc core dump.
//test.c
int test(a * a)
{
}

tcc -c test.c
you will get a core dump.

the following patch will fix it.

diff -u tcc-0.9.23/tcc.c tcc-0.9.23-lepton/tcc.c
--- tcc-0.9.23/tcc.c    2005-06-29 02:26:09.000000000 +0800
+++ tcc-0.9.23-lepton/tcc.c     2005-06-29 02:33:04.000000000 +0800
@@ -6839,6 +6839,8 @@
             } else {
             old_proto:
                 n = tok;
+               if(n<TOK_IDENT)
+                       error("syntax error!");
                 pt.t = VT_INT;
                 next();
             }
@@ -6853,7 +6855,8 @@
                     next();
                     break;
                 }
-            }
+            } else if (tok != ')')
+                   error("syntax error!");
         }
         /* if no parameters, then old type prototype */
         if (l == 0)


_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to