aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-04-15 15:35:40 +0200
committerSverker Eriksson <[email protected]>2013-04-15 15:35:40 +0200
commit76ae102a243aa05df79dde1f2639542147ec4b44 (patch)
tree22e34fcb8cdb7e6d1081f769f0398b4542154a5c
parent4caf3f8b94a38e738314f484d18b531dfa16ff8a (diff)
downloadotp-76ae102a243aa05df79dde1f2639542147ec4b44.tar.gz
otp-76ae102a243aa05df79dde1f2639542147ec4b44.tar.bz2
otp-76ae102a243aa05df79dde1f2639542147ec4b44.zip
erts: Remove unnecessary utf8 analysis step in external decoding
Faulty utf8 atoms are rejected anyway later when the atom is created.
-rw-r--r--erts/emulator/beam/external.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 5ce0d97c74..8420cfae24 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -3147,17 +3147,6 @@ encode_size_struct2(ErtsAtomCacheMap *acmp, Eterm obj, unsigned dflags)
return result;
}
-static int is_valid_utf8_atom(byte* bytes, Uint nbytes)
-{
- byte* err_pos;
- Uint num_chars;
-
- /*SVERK Do we really need to validate correct utf8? */
- return nbytes <= MAX_ATOM_SZ_LIMIT
- && erts_analyze_utf8(bytes, nbytes, &err_pos, &num_chars, NULL) == ERTS_UTF8_OK
- && num_chars <= MAX_ATOM_CHARACTERS;
-}
-
static Sint
decoded_size(byte *ep, byte* endp, int internal_tags)
{
@@ -3235,7 +3224,7 @@ decoded_size(byte *ep, byte* endp, int internal_tags)
CHKSIZE(2);
n = get_int16(ep);
ep += 2;
- if (!is_valid_utf8_atom(ep, n)) {
+ if (n > MAX_ATOM_SZ_LIMIT) {
return -1;
}
SKIP(n+atom_extra_skip);
@@ -3254,7 +3243,7 @@ decoded_size(byte *ep, byte* endp, int internal_tags)
CHKSIZE(1);
n = get_int8(ep);
ep++;
- if (!is_valid_utf8_atom(ep, n)) {
+ if (n > MAX_ATOM_SZ_LIMIT) {
return -1;
}
SKIP(n+atom_extra_skip);