LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 1048-stdlib-Do-not-check-base64-input-more-than-needed.patch of Package erlang (Project home:Ledest:erlang:20)

From 2ead5d429fe87ffedf0134d918c3b404e9fa70fe Mon Sep 17 00:00:00 2001
From: Hans Bolinder <hasse@erlang.org>
Date: Wed, 8 Nov 2017 12:41:23 +0100
Subject: [PATCH 4/5] stdlib: Do not check base64 input more than needed

Often the decode functions return a function_clause error, but not
always, and the errors have not been consistent between modifications
of the base64 module.

Now the errors are returned as they happen--no attempt to make them
look nice is done. The alternative, to ensure that, for example,
{badarg, Culprit} is always returned upon bad input, was deemed
pointless.
---
 lib/stdlib/src/base64.erl        |  6 ++----
 lib/stdlib/test/base64_SUITE.erl | 13 +++++++++----
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/stdlib/src/base64.erl b/lib/stdlib/src/base64.erl
index b4ff7b037f..6ea4147abf 100644
--- a/lib/stdlib/src/base64.erl
+++ b/lib/stdlib/src/base64.erl
@@ -383,8 +383,7 @@ only_ws_binary(<<>>, A) ->
     A;
 only_ws_binary(<<C:8, Cs/bits>>, A) ->
     case b64d(C) of
-        ws -> only_ws_binary(Cs, A);
-        _ -> erlang:error(function_clause)
+        ws -> only_ws_binary(Cs, A)
     end.
 
 decode_list_to_string([C1 | Cs]) ->
@@ -427,8 +426,7 @@ only_ws([], A) ->
     A;
 only_ws([C | Cs], A) ->
     case b64d(C) of
-        ws -> only_ws(Cs, A);
-        _ -> erlang:error(function_clause)
+        ws -> only_ws(Cs, A)
     end.
 
 %%%========================================================================
-- 
2.15.1