Closed jessie-murray closed 2 years ago
Thanks!
This looks good but I'm still concerned that there might be some other issues that aren't mentioned at build time. I haven't tested webdis very much on ARMv8; I do have a board with this architecture (a Jetson Nano), but haven't used it for this purpose yet. I'll try to find a way to validate builds on this architecture in the future though.
Rebased and merged as 55128ae.
http_parser.c
has a table namedunhex
that it uses to convert hex characters to their numeric values, e.g. 'F' -> 15. For non-hex characters, the value is -1 but while the table containsint8_t
values, the extraction is done using achar
. On ARMv8,char
is unsigned, which means it can't be compared to -1 as this is always false. Comparing to(char)-1
instead will work.Compiling Webdis on ARMv8 produces two warnings:
Here is a program that demonstrates the issue:
On x86_64, both 255 and -1 match all cases:
On ARMv8, only
(char)-1
matches:Changing the two comparisons against
-1
to(char)-1
fixes the issue.