uppsrc: Undefined Behaviour sanitization

git-svn-id: svn://ultimatepp.org/upp/trunk@13032 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-04-23 07:59:06 +00:00
parent 6f9358dbb4
commit 7ab13ffc80
18 changed files with 65 additions and 64 deletions

View file

@ -235,12 +235,14 @@ String QPDecode(const char *s, bool underscore_to_space)
return r;
}
String Base64Encode(const char *b, const char *e)
String Base64Encode(const char *_b, const char *_e)
{
static const char encoder[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
const byte *b = (byte *)_b; // avoid left shift of negative value sanitizer issue
const byte *e = (byte *)_e;
if(b == e)
return Null;
int out = (int(e - b) + 2) / 3 * 4;