Fix base64 decode error on ARM platforms #1853
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had the same problem as reported in #1768 when compiling the released version 1.14.3 of ros_comm on a Raspberry Pi 4 with gcc. Also here
char
seems to be an unsigned type and base64 decoding was broken. I assume this is the case on all ARM platforms.I found this patch in the upstream bugtracker at https://sourceforge.net/p/libb64/bugs/2/ created in 2012 by Jakub Wilk. The last proposed patch that I applied here was submitted by Jonathan Wakely in 2016.
Only when I wanted to open a pull request here I realized that #1769 already addressed the topic. Jonathan's patch leaves the API as-is (
char
) and eliminates the implicit conversions between signed and unsigned types. For example,static const char decoding[]
should not have negative values on implementations wherechar
is unsigned.The current patch (#1769) also solves the problem, but still produces sign conversion warnings on Raspbian 10 with gcc 8.3.0 and command line, while the new patch does not:
I leave it to the maintainers to decide whether to keep the current patch by @randoms or apply this patch provided by Jakub Wilk and Jonathan Wakely instead.