Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty string bind param causes floating point exception #145

Closed
wants to merge 1 commit into from
Closed

Fix empty string bind param causes floating point exception #145

wants to merge 1 commit into from

Conversation

xalopp
Copy link

@xalopp xalopp commented Sep 5, 2016

Fixes #141 and Fixes #144

@@ -1960,7 +1960,7 @@ void default_sql_size_and_scale( sqlsrv_stmt* stmt, unsigned int paramno, zval*
column_size = SQL_SERVER_MAX_TYPE_SIZE;
}
else {
column_size = SQL_SERVER_MAX_FIELD_SIZE / char_size;
column_size = (char_size == 0) ? 1 : (SQL_SERVER_MAX_FIELD_SIZE / char_size);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

char_size is computed differently on Windows:

Maybe not multiplying with the parameter string size would be a better fix?
Explaining the reason why the code changed in 4.0.3 would also help.

@meet-bhagdev
Copy link
Contributor

@xalopp thanks a ton for the PR. Your fix is definitely in the right direction. The problem is with character size when it is 0, so on line 1957 when we are calculating the char size, we don’t need the length of the parameter, and removing Z_STRLEN_P( param_z ) from char_size would solve this issue. We believe that will fix this issue along with some other idiosyncrasies that we observed. Stay tuned for our next release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants