|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesDatabase123. (last revision 2010-11-19 06:44 UTC by sex_perversss at yahoo dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-07-03 15:06 UTC] felipe@php.net
[2010-07-03 15:06 UTC] felipe@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: felipe
[2010-07-03 15:06 UTC] felipe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ in ./ext/hash/hash.c, line 559 The hash_copy() function does not copy the hash->key field. It only copies the pointer. Because of hash_final() clears the key, the result of hash_final of copied hashing resource gives wrong results. It causes random PHP crashes too, because the pointer to the HMAC key can be invalid (released within the other hashing context). Test script: --------------- $h = hash_init('crc32b', HASH_HMAC, '123456' ); $h2 = hash_copy($h); var_dump(hash_final($h)); var_dump(hash_final($h2)); echo '<-- These two results should be the same.'; Expected result: ---------------- string(8) "278af264" string(8) "278af264" <-- These two results should be the same. Actual result: -------------- string(8) "278af264" string(8) "07997b35" <-- These two results should be the same.