From 8eb544073fe243a8935a54f83f9c9f1f7478e3c5 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 22 Jan 2013 17:20:17 +0100 Subject: erts: Fix bug in analyze_utf8 causing faulty latin1 detection --- erts/emulator/beam/erl_unicode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'erts/emulator/beam/erl_unicode.c') diff --git a/erts/emulator/beam/erl_unicode.c b/erts/emulator/beam/erl_unicode.c index c00293de89..883405d066 100644 --- a/erts/emulator/beam/erl_unicode.c +++ b/erts/emulator/beam/erl_unicode.c @@ -1180,13 +1180,13 @@ analyze_utf8(byte *source, Uint size, byte **err_pos, Uint *num_chars, int *left ((*source) < 0xC2) /* overlong */) { return ERTS_UTF8_ERROR; } - source += 2; - size -= 2; if (num_latin1_chars) { latin1_count++; if ((source[0] & ((byte) 0xFC)) != ((byte) 0xC0)) is_latin1 = 0; } + source += 2; + size -= 2; } else if (((*source) & ((byte) 0xF0)) == 0xE0) { if (size < 3) { return ERTS_UTF8_INCOMPLETE; -- cgit v1.2.3