On 01/17/2011 03:01 PM, Pierre Joye wrote:
> pajoye                                   Mon, 17 Jan 2011 14:01:01 +0000
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=307537
> 
> Log:
> - fix NULL derefencing
> 
> Changed paths:
>     U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
>     U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
> 
> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
> ===================================================================
> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
> 13:44:54 UTC (rev 307536)
> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c     2011-01-17 
> 14:01:01 UTC (rev 307537)
> @@ -735,7 +735,7 @@
> 
>       DBG_ENTER("mysqlnd_fetch_stmt_row_buffered");
>       *fetched_anything = FALSE;
> -     DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
> +     DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L);
> 
>       /* If we haven't read everything */
>       if (set->data_cursor &&
> @@ -2223,9 +2223,9 @@
>  static enum_func_status
>  MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool 
> implicit TSRMLS_DC)
>  {
> -     MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
> +     MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
>       enum_func_status ret = FAIL;
> -     zend_bool persistent = s->persistent;
> +     zend_bool persistent = (s == NULL) ? s->persistent : 0;

This breaks mysqlnd. Why? Because you turn around the meaning. s? means
s!=NULL and you change it to s==NULL but leave the rest of the ternary
intact. Did you run the tests, because 117 more failing test, out of
432. This is hard to oversee if you run the test suite!

Best,
Andrey

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to