Repository navigation
PR for Password Hash RFC - #191
Conversation
…nt overflow on allocation
Conflicts: ext/standard/crypt.c
* upstream/master: (34 commits) Fixed Bug #62500 (Segfault in DateInterval class when extended) Fixed test bug #62312 (warnings changed one more time) fix valgrind warning fix valgrind warning fixed #62433 test for win update NEWS Fixed bug #62499 (curl_setopt($ch, CURLOPT_COOKIEFILE, "") returns false) appease MSVC (doesnt like unary minus of unsigned ints) appease MSVC (doesnt like unary minus of unsigned ints) appease MSVC (doesnt like unary minus of unsigned ints) - Fixed bug #62507 (['REQUEST_TIME'] under mod_php5 returns miliseconds instead of seconds) Fixed Bug #62500 (Segfault in DateInterval class when extended) Added in NEWS and UPGRADING for feature 55218 Fix two issues with run-tests.php Fix potential integer overflow in nl2br Fix potential integer overflow in bin2hex This wil be PHP 5.3.16 Revert change 3f3ad30: There shouldn't be new features in 5.3, especially not if they aren't in 5.4, too. fix (signed) integer overflow (part of bug #52550 fix (signed) integer overflow (part of bug #52550 ...
* upstream/master: (393 commits) forked two tests for windows Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice). Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice) Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty string or false Implemented ReflectionFunction::isGenerator() Allow null as a default value for length in mb_substr() and mb_strcut() Allow null as a default value for length in mb_substr() and mb_strcut() folder Initializing optional argument description in assert() Initializing optional argument description in assert() Fix test failed due to new Token T_YIELD fix NEWS Fix leak when yielding array as key Drop obsolete test Remove extra blank in notice message, should act as same as vm Fixed bug #62987 (Assigning to ArrayObject[null][something] overrides all undefined variables) assert() user message ...
|
I've just added a commit to switch the algorithms definition to an ENUM (cleaner and allows for better type checking in the algos functions... |
There was a problem hiding this comment.
I'd rather call this enum php_password_algo (singular) as it fits in better with parameters and return values. Also I don't see why you removed the PHP_ prefix for the enum values. Those are global, so they should be prefixed too. (Only C++11 has proper non-global enum class values.)
There was a problem hiding this comment.
Fixed by the next push.
There was a problem hiding this comment.
Here again the last arg should be 2 (as the algo is required too).
There was a problem hiding this comment.
Use of the symtable function is not necessary here (only required when you're taking user input as the key), could be just zend_hash_find. The 5 would be better written as sizeof("cost"), to clarify its meaning.
There was a problem hiding this comment.
This zval_ptr_dtor isn't right here. zend_symtable_find does not add an additional ref. Though I'm a bit confused now how this should be properly done when convert_to_long_ex is used...
There was a problem hiding this comment.
An example what would usually happen:
==7601== Invalid read of size 4
==7601== at 0x8250A1E: _zval_ptr_dtor (zend.h:404)
==7601== by 0x826235E: _zval_ptr_dtor_wrapper (zend_variables.c:180)
==7601== by 0x8276453: zend_hash_destroy (zend_hash.c:560)
==7601== by 0x8261EFB: _zval_dtor_func (zend_variables.c:43)
==7601== by 0x82A6E58: zend_do_fcall_common_helper_SPEC (zend_variables.h:35)
==7601== by 0x82AE0B9: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:2447)
==7601== by 0x82A453E: execute_ex (zend_vm_execute.h:440)
==7601== by 0x82A4614: execute (zend_vm_execute.h:464)
==7601== by 0x826665C: zend_execute_scripts (zend.c:1309)
==7601== by 0x81C861B: php_execute_script (main.c:2459)
==7601== by 0x83C5358: do_cli (php_cli.c:988)
==7601== by 0x83C6893: main (php_cli.c:1364)
==7601== Address 0x43ebe68 is 8 bytes inside a block of size 20 free'd
==7601== at 0x402B06C: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7601== by 0x822C56A: _efree (zend_alloc.c:2433)
==7601== by 0x8250AFD: _zval_ptr_dtor (zend_execute_API.c:440)
==7601== by 0x81BDC94: zif_password_needs_rehash (password.c:250)
==7601== by 0x82A5FBE: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:655)
=> The value is first freed here and later in the hash dtor.
There was a problem hiding this comment.
All memory leaks that I could find have been rectified. Please test again...
|
I'm still getting a lot of valgrind warnings, e.g. |
|
Also from a quick look at the new code, you're using |
|
Can you provide the test code, so I can integrate it with the unit tests?
|
|
@ircmaxell I get that when running |
This is the pull request for the Password Hash RFC which was accepted.
Please review the changes, and if all looks good I will merge the PR in.
Thanks
Anthony