diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-12-28 09:36:16 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-12-28 09:36:16 +0000 |
commit | 527df579b2667fd0b8db4c07bcab268e0f401be9 (patch) | |
tree | 4b3ce9cb56db5e1c69dbb3b321b8b9fc4c6b2e6e /hv.c | |
parent | a44093a96fbebc6fd778dfaa82b165e9006382a8 (diff) | |
download | perl-527df579b2667fd0b8db4c07bcab268e0f401be9.tar.gz |
Precomputing the hash value for a string representable in bytes, but passed in
in UTF-8, would result in storing the wrong hash value in the hash, and hence
failing lookups. I guess not that much XS code precomputes hash values.
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -606,6 +606,11 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, if (flags & HVhek_FREEKEY) Safefree(keysave); flags |= HVhek_WASUTF8 | HVhek_FREEKEY; + /* If the caller calculated a hash, it was on the sequence of + octets that are the UTF-8 form. We've now changed the sequence + of octets stored to that of the equivalent byte representation, + so the hash we need is different. */ + hash = 0; } } |