bakaid commented on issue #690: MINIFICPP-1026 - Added base64 encoder-decoder to StringUtils URL: https://github.com/apache/nifi-minifi-cpp/pull/690#issuecomment-562140383 > It seems that we're leaning toward writing too much library code here. We build curl in most cases and in the cases where we can't we likely couldn't run anyway -- why not just rely on that which is already available versus writing our own. - cURL does not have a public base64 encode-decode API. We have been using a header file adapted from the base64 implementation of an older cURL version, and used it independently of whether we actually built cURL. - that implementation was a particularly bad one and has since been rewritten in cURL: - it contained a buffer overread with the comment `This final decode may actually read slightly past the end of the buffer if the input string is missing pad bytes. This will almost always be harmless.` - it couldn't handle invalid characters in base64-encoded strings (didn't signal an error, just resulted in garbage) - it couldn't handle newlines, which are potentially valid in base64-encoded strings (didn't signal an error, just resulted in garbage) - it couldn't handle url-safe base64 - the newer cURL implementation depends on other cURL-specific code. It could have been rewritten to be used independently of cURL, but I decided to create an own, well-tested implementation instead. - keep in mind that even if we used some base64 implementation from a third party we would still need - all the StringUtils functions that wrap it, except the encoding/decoding function - all the tests - "We build curl in most cases and in the cases where we can't we likely couldn't run anyway" is not a very convincing argument for anything. We should either make cURL build mandatory or fix the non-cURL build, if it indeed couldn't run.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
