• Harris Hancock's avatar
    decodeBase64() reports errors required by HTML spec · f3e0ed22
    Harris Hancock authored
    This change modifies decodeBase64() to report errors as required by the WHATWG HTML spec's atob() JavaScript function. Notably, it reports errors for non-whitespace characters outside of the valid base64 character range ([+/0-9A-Za-z=]), and performs sanity checks on padding and input length.
    
    I took care to keep the algorithm single-pass, and to support streaming via multiple calls of base64_decode_block(), though we don't currently expose that functionality.
    f3e0ed22
encoding.h 7.9 KB