aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-08-30 19:53:37 +0200
committerSverker Eriksson <[email protected]>2017-08-30 20:21:10 +0200
commit97dc5e7f396129222419811c173edc7fa767b0f8 (patch)
tree636fd537cd1634a04176d635183668efa64c3650 /erts/emulator/beam
parent8cece79b77952c991e62ae595bcf71cde016a052 (diff)
downloadotp-97dc5e7f396129222419811c173edc7fa767b0f8.tar.gz
otp-97dc5e7f396129222419811c173edc7fa767b0f8.tar.bz2
otp-97dc5e7f396129222419811c173edc7fa767b0f8.zip
erts: Fix crash in binary_to_atom/term for invalid utf8
such as a sub-binary, of a correct utf8 string, that ends in the middle of a character.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/atom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/atom.c b/erts/emulator/beam/atom.c
index 84d2d5e3ed..f95582d1ab 100644
--- a/erts/emulator/beam/atom.c
+++ b/erts/emulator/beam/atom.c
@@ -137,7 +137,7 @@ atom_hash(Atom* obj)
while(len--) {
v = *p++;
/* latin1 clutch for r16 */
- if ((v & 0xFE) == 0xC2 && (*p & 0xC0) == 0x80) {
+ if (len && (v & 0xFE) == 0xC2 && (*p & 0xC0) == 0x80) {
v = (v << 6) | (*p & 0x3F);
p++; len--;
}