iliaa Sun Nov 12 17:49:20 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/pdo pdo_sql_parser.c pdo_sql_parser.re Log: Fixed a memory leak when named & positional params are being used in the same query.
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_sql_parser.c?r1=1.35.2.6&r2=1.35.2.6.2.1&diff_format=u Index: php-src/ext/pdo/pdo_sql_parser.c diff -u php-src/ext/pdo/pdo_sql_parser.c:1.35.2.6 php-src/ext/pdo/pdo_sql_parser.c:1.35.2.6.2.1 --- php-src/ext/pdo/pdo_sql_parser.c:1.35.2.6 Wed Jan 25 16:35:23 2006 +++ php-src/ext/pdo/pdo_sql_parser.c Sun Nov 12 17:49:19 2006 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.11 on Wed Jan 25 11:31:13 2006 */ +/* Generated by re2c 0.10.6 on Sun Nov 12 12:48:44 2006 */ #line 1 "ext/pdo/pdo_sql_parser.re" /* +----------------------------------------------------------------------+ @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_sql_parser.c,v 1.35.2.6 2006/01/25 16:35:23 iliaa Exp $ */ +/* $Id: pdo_sql_parser.c,v 1.35.2.6.2.1 2006/11/12 17:49:19 iliaa Exp $ */ #include "php.h" #include "php_pdo_driver.h" @@ -51,241 +51,271 @@ { static unsigned char yybm[] = { - 0, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 52, 162, 162, 162, 162, 196, - 162, 162, 162, 162, 162, 162, 162, 162, - 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 244, 162, 162, 162, 162, 244, - 162, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 162, 2, 162, 162, 170, - 162, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, + 0, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 52, 162, 162, 162, 162, 196, + 162, 162, 162, 162, 162, 162, 162, 162, + 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 244, 162, 162, 162, 162, 244, + 162, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 162, 2, 162, 162, 170, + 162, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, + 162, 162, 162, 162, 162, 162, 162, 162, }; #line 89 "ext/pdo/pdo_sql_parser.c" -{ - YYCTYPE yych; - unsigned int yyaccept = 0; - goto yy0; - ++YYCURSOR; -yy0: - if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); - yych = *YYCURSOR; - if(yybm[0+yych] & 2) { - goto yy8; - } - if(yych <= 0x00) goto yy11; - if(yych <= '&') goto yy2; - if(yych <= '\'') goto yy4; - if(yych <= '>') goto yy5; - goto yy6; -yy2: yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if(yybm[0+yych] & 64) { - goto yy30; - } - if(yych <= 0x00) goto yy3; - if(yych == '"') goto yy28; - goto yy33; + { + YYCTYPE yych; + unsigned int yyaccept = 0; + + YYDEBUG(0, *YYCURSOR); + if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); + yych = *YYCURSOR; + if(yybm[0+yych] & 2) { + goto yy8; + } + if(yych <= 0x00) goto yy11; + if(yych <= '&') goto yy2; + if(yych <= '\'') goto yy4; + if(yych <= '>') goto yy5; + goto yy6; +yy2: + YYDEBUG(2, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if(yybm[0+yych] & 64) { + goto yy30; + } + if(yych <= 0x00) goto yy3; + if(yych == '"') goto yy28; + goto yy33; yy3: + YYDEBUG(3, *YYCURSOR); #line 63 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_TEXT); } -#line 117 "ext/pdo/pdo_sql_parser.c" -yy4: yyaccept = 0; - yych = *(YYMARKER = ++YYCURSOR); - if(yybm[0+yych] & 16) { - goto yy19; - } - if(yych <= 0x00) goto yy3; - if(yych == '\'') goto yy21; - goto yy24; -yy5: yych = *++YYCURSOR; - if(yybm[0+yych] & 4) { - goto yy13; - } - if(yych <= 'Z'){ - if(yych <= '/') goto yy3; - if(yych <= ':') goto yy16; - if(yych <= '@') goto yy3; - goto yy16; - } else { - if(yych <= '_'){ - if(yych <= '^') goto yy3; + { RET(PDO_PARSER_TEXT); } +#line 119 "ext/pdo/pdo_sql_parser.c" +yy4: + YYDEBUG(4, *YYCURSOR); + yyaccept = 0; + yych = *(YYMARKER = ++YYCURSOR); + if(yybm[0+yych] & 16) { + goto yy19; + } + if(yych <= 0x00) goto yy3; + if(yych == '\'') goto yy21; + goto yy24; +yy5: + YYDEBUG(5, *YYCURSOR); + yych = *++YYCURSOR; + if(yybm[0+yych] & 4) { + goto yy13; + } + if(yych <= 'Z') { + if(yych <= '/') goto yy3; + if(yych <= ':') goto yy16; + if(yych <= '@') goto yy3; goto yy16; } else { - if(yych <= '`') goto yy3; - if(yych <= 'z') goto yy16; - goto yy3; + if(yych <= '_') { + if(yych <= '^') goto yy3; + goto yy16; + } else { + if(yych <= '`') goto yy3; + if(yych <= 'z') goto yy16; + goto yy3; + } } - } -yy6: ++YYCURSOR; - if(yybm[0+(yych = *YYCURSOR)] & 4) { - yych = *YYCURSOR; - goto yy13; - } - goto yy7; -yy7: +yy6: + YYDEBUG(6, *YYCURSOR); + ++YYCURSOR; + if(yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy13; + } + YYDEBUG(7, *YYCURSOR); #line 62 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_BIND_POS); } -#line 154 "ext/pdo/pdo_sql_parser.c" -yy8: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - goto yy9; -yy9: if(yybm[0+yych] & 2) { - goto yy8; - } - goto yy10; -yy10: + { RET(PDO_PARSER_BIND_POS); } +#line 160 "ext/pdo/pdo_sql_parser.c" +yy8: + YYDEBUG(8, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(9, *YYCURSOR); + if(yybm[0+yych] & 2) { + goto yy8; + } + YYDEBUG(10, *YYCURSOR); #line 64 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_TEXT); } -#line 166 "ext/pdo/pdo_sql_parser.c" -yy11: ++YYCURSOR; - goto yy12; -yy12: + { RET(PDO_PARSER_TEXT); } +#line 173 "ext/pdo/pdo_sql_parser.c" +yy11: + YYDEBUG(11, *YYCURSOR); + ++YYCURSOR; + YYDEBUG(12, *YYCURSOR); #line 65 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_EOI); } -#line 172 "ext/pdo/pdo_sql_parser.c" -yy13: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - goto yy14; -yy14: if(yybm[0+yych] & 4) { - goto yy13; - } - goto yy15; + { RET(PDO_PARSER_EOI); } +#line 180 "ext/pdo/pdo_sql_parser.c" +yy13: + YYDEBUG(13, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(14, *YYCURSOR); + if(yybm[0+yych] & 4) { + goto yy13; + } yy15: + YYDEBUG(15, *YYCURSOR); #line 60 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_TEXT); } -#line 184 "ext/pdo/pdo_sql_parser.c" -yy16: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - goto yy17; -yy17: if(yybm[0+yych] & 8) { - goto yy16; - } - goto yy18; -yy18: + { RET(PDO_PARSER_TEXT); } +#line 194 "ext/pdo/pdo_sql_parser.c" +yy16: + YYDEBUG(16, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + YYDEBUG(17, *YYCURSOR); + if(yybm[0+yych] & 8) { + goto yy16; + } + YYDEBUG(18, *YYCURSOR); #line 61 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_BIND); } -#line 196 "ext/pdo/pdo_sql_parser.c" -yy19: yyaccept = 1; - YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - goto yy20; -yy20: if(yybm[0+yych] & 16) { - goto yy19; - } - if(yych <= '\''){ - if(yych <= 0x00) goto yy15; - if(yych <= '&') goto yy23; - goto yy21; - } else { - if(yych == '\\') goto yy26; - goto yy23; - } -yy21: ++YYCURSOR; - if(yybm[0+(yych = *YYCURSOR)] & 4) { + { RET(PDO_PARSER_BIND); } +#line 207 "ext/pdo/pdo_sql_parser.c" +yy19: + YYDEBUG(19, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; - goto yy13; - } - goto yy22; + YYDEBUG(20, *YYCURSOR); + if(yybm[0+yych] & 16) { + goto yy19; + } + if(yych <= '\'') { + if(yych <= 0x00) goto yy15; + if(yych <= '&') goto yy23; + } else { + if(yych == '\\') goto yy26; + goto yy23; + } +yy21: + YYDEBUG(21, *YYCURSOR); + ++YYCURSOR; + if(yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy13; + } yy22: + YYDEBUG(22, *YYCURSOR); #line 59 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_TEXT); } -#line 222 "ext/pdo/pdo_sql_parser.c" -yy23: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - goto yy24; -yy24: if(yybm[0+yych] & 32) { - goto yy23; - } - if(yych <= 0x00) goto yy25; - if(yych <= '[') goto yy27; - goto yy26; -yy25: YYCURSOR = YYMARKER; - switch(yyaccept){ - case 1: goto yy15; - case 0: goto yy3; - } -yy26: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - if(yych == '\'') goto yy23; - goto yy25; -yy27: yych = *++YYCURSOR; - goto yy22; -yy28: ++YYCURSOR; - if(yybm[0+(yych = *YYCURSOR)] & 4) { + { RET(PDO_PARSER_TEXT); } +#line 235 "ext/pdo/pdo_sql_parser.c" +yy23: + YYDEBUG(23, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; - goto yy13; - } - goto yy29; +yy24: + YYDEBUG(24, *YYCURSOR); + if(yybm[0+yych] & 32) { + goto yy23; + } + if(yych <= 0x00) goto yy25; + if(yych <= '[') goto yy27; + goto yy26; +yy25: + YYDEBUG(25, *YYCURSOR); + YYCURSOR = YYMARKER; + if(yyaccept <= 0) { + goto yy3; + } else { + goto yy15; + } +yy26: + YYDEBUG(26, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if(yych == '\'') goto yy23; + goto yy25; +yy27: + YYDEBUG(27, *YYCURSOR); + yych = *++YYCURSOR; + goto yy22; +yy28: + YYDEBUG(28, *YYCURSOR); + ++YYCURSOR; + if(yybm[0+(yych = *YYCURSOR)] & 4) { + goto yy13; + } yy29: + YYDEBUG(29, *YYCURSOR); #line 58 "ext/pdo/pdo_sql_parser.re" -{ RET(PDO_PARSER_TEXT); } -#line 254 "ext/pdo/pdo_sql_parser.c" -yy30: yyaccept = 1; - YYMARKER = ++YYCURSOR; - if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); - yych = *YYCURSOR; - goto yy31; -yy31: if(yybm[0+yych] & 64) { - goto yy30; - } - if(yych <= '"'){ - if(yych <= 0x00) goto yy15; - if(yych >= '"') goto yy28; - goto yy32; - } else { - if(yych == '\\') goto yy34; - goto yy32; + { RET(PDO_PARSER_TEXT); } +#line 278 "ext/pdo/pdo_sql_parser.c" +yy30: + YYDEBUG(30, *YYCURSOR); + yyaccept = 1; + YYMARKER = ++YYCURSOR; + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR; + YYDEBUG(31, *YYCURSOR); + if(yybm[0+yych] & 64) { + goto yy30; + } + if(yych <= '"') { + if(yych <= 0x00) goto yy15; + if(yych >= '"') goto yy28; + } else { + if(yych == '\\') goto yy34; + } +yy32: + YYDEBUG(32, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; +yy33: + YYDEBUG(33, *YYCURSOR); + if(yybm[0+yych] & 128) { + goto yy32; + } + if(yych <= 0x00) goto yy25; + if(yych <= '[') goto yy35; +yy34: + YYDEBUG(34, *YYCURSOR); + ++YYCURSOR; + if(YYLIMIT == YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + if(yych == '"') goto yy32; + goto yy25; +yy35: + YYDEBUG(35, *YYCURSOR); + ++YYCURSOR; + yych = *YYCURSOR; + goto yy29; } -yy32: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - goto yy33; -yy33: if(yybm[0+yych] & 128) { - goto yy32; - } - if(yych <= 0x00) goto yy25; - if(yych <= '[') goto yy35; - goto yy34; -yy34: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); - yych = *YYCURSOR; - if(yych == '"') goto yy32; - goto yy25; -yy35: ++YYCURSOR; - yych = *YYCURSOR; - goto yy29; -} } #line 66 "ext/pdo/pdo_sql_parser.re" @@ -353,7 +383,8 @@ if (query_type == (PDO_PLACEHOLDER_NAMED|PDO_PLACEHOLDER_POSITIONAL)) { /* they mixed both types; punt */ pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters" TSRMLS_CC); - return -1; + ret = -1; + goto clean_up; } http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_sql_parser.re?r1=1.28.2.4&r2=1.28.2.4.2.1&diff_format=u Index: php-src/ext/pdo/pdo_sql_parser.re diff -u php-src/ext/pdo/pdo_sql_parser.re:1.28.2.4 php-src/ext/pdo/pdo_sql_parser.re:1.28.2.4.2.1 --- php-src/ext/pdo/pdo_sql_parser.re:1.28.2.4 Wed Jan 25 16:35:23 2006 +++ php-src/ext/pdo/pdo_sql_parser.re Sun Nov 12 17:49:19 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdo_sql_parser.re,v 1.28.2.4 2006/01/25 16:35:23 iliaa Exp $ */ +/* $Id: pdo_sql_parser.re,v 1.28.2.4.2.1 2006/11/12 17:49:19 iliaa Exp $ */ #include "php.h" #include "php_pdo_driver.h" @@ -128,7 +128,8 @@ if (query_type == (PDO_PLACEHOLDER_NAMED|PDO_PLACEHOLDER_POSITIONAL)) { /* they mixed both types; punt */ pdo_raise_impl_error(stmt->dbh, stmt, "HY093", "mixed named and positional parameters" TSRMLS_CC); - return -1; + ret = -1; + goto clean_up; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php