Merge pull request #395 from v-kaywon/fix_uninit_read
fix uninitialized read if pos of string parser is -1
This commit is contained in:
commit
4537021d1b
|
@ -415,9 +415,12 @@ void conn_string_parser:: parse_conn_string( TSRMLS_D )
|
||||||
// Primary function which parses out the named placeholders from a sql string.
|
// Primary function which parses out the named placeholders from a sql string.
|
||||||
void sql_string_parser::parse_sql_string( TSRMLS_D ) {
|
void sql_string_parser::parse_sql_string( TSRMLS_D ) {
|
||||||
try {
|
try {
|
||||||
while ( !this->is_eos() ) {
|
|
||||||
int start_pos = -1;
|
int start_pos = -1;
|
||||||
|
while ( !this->is_eos() ) {
|
||||||
|
// if pos is -1, then reading from a string is an initialized read
|
||||||
|
if ( pos == -1 ) {
|
||||||
|
next();
|
||||||
|
}
|
||||||
// skip until a '"', '\'', ':' or '?'
|
// skip until a '"', '\'', ':' or '?'
|
||||||
char sym;
|
char sym;
|
||||||
while ( this->orig_str[pos] != '"' && this->orig_str[pos] != '\'' && this->orig_str[pos] != ':' && this->orig_str[pos] != '?' && !this->is_eos() ) {
|
while ( this->orig_str[pos] != '"' && this->orig_str[pos] != '\'' && this->orig_str[pos] != ':' && this->orig_str[pos] != '?' && !this->is_eos() ) {
|
||||||
|
|
Loading…
Reference in a new issue