1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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
This commit is contained in:
drh
2007-01-16 18:19:12 +00:00
parent 61e339a60d
commit cb6c565eab
3 changed files with 14 additions and 9 deletions

View File

@ -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