From cb6c565eab95bf7d34f21abd35ec6d6f1811e998 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 16 Jan 2007 18:19:12 +0000 Subject: [PATCH] Additional memory initialization in lemon - bug reported from wireshark. Ticket #2172. Note this problem only comes up with certain grammars, and does not impact SQLite. On the other hand, it might cause SQLite to run slower. So we might want to revisit this change at some point. (CVS 3594) FossilOrigin-Name: d537aa5edecb5c7b84d8eb876453f385f6f3d91a --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/lempar.c | 9 +++++++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 6fdd12e115..eccd6e42e8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sparser\sgenerated\sby\slemon\salways\scalls\sdestructors\son\nunused\ssymbols,\seven\sif\sthere\sis\sno\saction\sfollowing\sthe\srule.\nTicket\s#2171.\s(CVS\s3593) -D 2007-01-16T03:09:03 +C Additional\smemory\sinitialization\sin\slemon\s-\sbug\sreported\sfrom\swireshark.\nTicket\s#2172.\s\sNote\sthis\sproblem\sonly\scomes\sup\swith\scertain\sgrammars,\nand\sdoes\snot\simpact\sSQLite.\s\sOn\sthe\sother\shand,\sit\smight\scause\sSQLite\nto\srun\sslower.\s\sSo\swe\smight\swant\sto\srevisit\sthis\schange\sat\ssome\spoint.\s(CVS\s3594) +D 2007-01-16T18:19:13 F Makefile.in 7fa74bf4359aa899da5586e394d17735f221315f F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -354,7 +354,7 @@ F test/where2.test 61d5b20d9bedc8788a773bbdc5b2ef887725928e F test/where3.test 0a30fe9808b0fa01c46d0fcf4fac0bf6cf75bb30 F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b F tool/lemon.c 2938bec507110397c937bd8a03b0c9596a709a04 -F tool/lempar.c 0a2a5cf96a98a64a5594625ad8fbdbe41dbaca50 +F tool/lempar.c fdc1672e97f72f72e76553038501da40fec9d251 F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133 F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf @@ -424,7 +424,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 87248470362f444f2339fee18d3624e8544f5256 -R 215b3e2a99296aa81351d696d69a7c89 +P 0c5c1b931dfdc163f300f458e4b305c9f50e17f8 +R 6f01158303ccfd20d2d6b3101557a041 U drh -Z 05ac11539ce5473e2ed5468a4de2ce22 +Z a3648b01ded082bd6cd70ae0b6771f9c diff --git a/manifest.uuid b/manifest.uuid index 875a8e59a2..d096e60bbb 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0c5c1b931dfdc163f300f458e4b305c9f50e17f8 \ No newline at end of file +d537aa5edecb5c7b84d8eb876453f385f6f3d91a \ No newline at end of file diff --git a/tool/lempar.c b/tool/lempar.c index a18c43a24d..916b575127 100644 --- a/tool/lempar.c +++ b/tool/lempar.c @@ -476,7 +476,6 @@ static void yy_reduce( } #endif /* NDEBUG */ -#ifndef NDEBUG /* Silence complaints from purify about yygotominor being uninitialized ** in some cases when it is copied into the stack after the following ** switch. yygotominor is uninitialized when a rule reduces that does @@ -484,9 +483,15 @@ static void yy_reduce( ** value of the nonterminal uninitialized is utterly harmless as long ** as the value is never used. So really the only thing this code ** accomplishes is to quieten purify. + ** + ** 2007-01-16: The wireshark project (www.wireshark.org) reports that + ** without this code, their parser segfaults. I'm not sure what there + ** parser is doing to make this happen. This is the second bug report + ** from wireshark this week. Clearly they are stressing Lemon in ways + ** that it has not been previously stressed... (SQLite ticket #2172) */ memset(&yygotominor, 0, sizeof(yygotominor)); -#endif + switch( yyruleno ){ /* Beginning here are the reduction cases. A typical example