Skip to content

Conversation

sskaje
Copy link
Contributor

@sskaje sskaje commented Nov 20, 2013

@@ -585,7 +585,8 @@ void _mysqlnd_init_ps_fetch_subsystem()
*/
if (Z_TYPE_P(stmt->param_bind[i].zv) != IS_LONG) {
zval *tmp_data = (copies && copies[i])? copies[i]: stmt->param_bind[i].zv;
convert_to_double_ex(&tmp_data);
//convert_to_double_ex(&tmp_data);
convert_to_long_ex(&tmp_data);
if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
Copy link
Member

Choose a reason for hiding this comment

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

Accessing DVAL after casting to long? That can't be right...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right nikic, I put my focus on my problem but forgetting to get everything right, sorry for that.
but the convert to double issue really caused my problem, maybe I should get another temporary zval to make old code working as well

Choose a reason for hiding this comment

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

Die Zustellung an folgende Empfänger oder Gruppen verzögert sich:

p.bandow@justepic.infomailto:p.bandow@justepic.info

Betreff: Re: [php-src] Fixed bug #66124 (#532)

Diese Nachricht wurde noch nicht zugestellt. Es wird weiterhin versucht, die Nachricht zuzustellen.

Der Server wird noch 2 Tage, 22 Stunden und 58 Minuten versuchen, die Nachricht zuzustellen. Sie erhalten eine Benachrichtigung, falls die Nachricht bis dahin nicht übermittelt werden konnte.

Choose a reason for hiding this comment

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

Die Zustellung an folgende Empfänger oder Gruppen verzögert sich:

p.bandow@justepic.infomailto:p.bandow@justepic.info

Betreff: Re: [php-src] Fixed bug #66124 (#532)

Diese Nachricht wurde noch nicht zugestellt. Es wird weiterhin versucht, die Nachricht zuzustellen.

Der Server wird noch 2 Tage, 22 Stunden und 57 Minuten versuchen, die Nachricht zuzustellen. Sie erhalten eine Benachrichtigung, falls die Nachricht bis dahin nicht übermittelt werden konnte.

@sskaje
Copy link
Contributor Author

sskaje commented Nov 20, 2013

@nikic would you please review the latest commit?

if (Z_DVAL_P(tmp_data) > LONG_MAX || Z_DVAL_P(tmp_data) < LONG_MIN) {
stmt->send_types_to_server = resend_types_next_time = 1;
}
zval_dtor(tmp_data);
Copy link
Member

Choose a reason for hiding this comment

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

You created the zval with MAKE_STD_ZVAL but destroy with zval_dtor, that will leak the container. You're probably looking for something like this:

zval tmp_data;
ZVAL_ZVAL(&tmp_data, (copies && copies[i]) ? copies[i]: stmt->param_bind[i].zv, 1, 0);
convert_to_double(&tmp_data);
// ...
zval_dtor(&tmp_data);

That's the semi-standard approach to performing a cast without touching the zval. The ZVAL_ZVAL is the same as ZVAL_COPY_VALUE+zval_copy_ctor.

@sskaje sskaje closed this Nov 25, 2013
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.

3 participants