aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
866 stars 162 forks source link

decode size_t failed #73

Closed lihongyi1234 closed 3 years ago

lihongyi1234 commented 3 years ago

hello, I test the fast64 decode, it indeed faster than other code, but i counter a problem when using function int base64_decode( const charsrc, size_t srclen, char out, size_t *outlen, int flags) ; it's unknow about out's size ,it easy to decode failed when size is small, how can i solve it

aklomp commented 3 years ago

The output buffer should be at least 3/4 the size of the input buffer, because every four Base64 bytes are turned into three regular bytes. The user is responsible for allocating a large enough buffer using this rule of thumb.