tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] [bug fix]core dump when parse function parameters


From: lepton
Subject: [Tinycc-devel] [bug fix]core dump when parse function parameters
Date: Wed, 29 Jun 2005 02:37:09 +0800

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)




reply via email to

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