diff options
author | Björn-Egil Dahlberg <[email protected]> | 2013-02-18 17:22:37 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2013-02-19 10:00:06 +0100 |
commit | 568397e6ad87270c581b7787fce44985e131eb7e (patch) | |
tree | 743e57758873d49473ae51c275ec13646f6f291c /erts/emulator | |
parent | 0b3617b7118e7b6e40c73d730734904ffa8b68cc (diff) | |
download | otp-568397e6ad87270c581b7787fce44985e131eb7e.tar.gz otp-568397e6ad87270c581b7787fce44985e131eb7e.tar.bz2 otp-568397e6ad87270c581b7787fce44985e131eb7e.zip |
erts: Fix atom hash for latin1 characters
Non ASCII latin1 characters were hashed as utf8 which breaks
compatability.
Diffstat (limited to 'erts/emulator')
-rw-r--r-- | erts/emulator/beam/atom.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/erts/emulator/beam/atom.c b/erts/emulator/beam/atom.c index b69f979397..84d2d5e3ed 100644 --- a/erts/emulator/beam/atom.c +++ b/erts/emulator/beam/atom.c @@ -132,9 +132,17 @@ atom_hash(Atom* obj) byte* p = obj->name; int len = obj->len; HashValue h = 0, g; + byte v; while(len--) { - h = (h << 4) + *p++; + v = *p++; + /* latin1 clutch for r16 */ + if ((v & 0xFE) == 0xC2 && (*p & 0xC0) == 0x80) { + v = (v << 6) | (*p & 0x3F); + p++; len--; + } + /* normal hashpjw follows for v */ + h = (h << 4) + v; if ((g = h & 0xf0000000)) { h ^= (g >> 24); h ^= g; |