mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-16 02:26:54 +00:00
BUG/MINOR: tools: fix my_htonll() on x86_64
Commit 36eb3a3
("MINOR: tools: make my_htonll() more efficient on x86_64")
brought an incorrect asm statement missing the input constraints, causing
the input value not necessarily to be placed into the same register as the
output one, resulting in random output. It happens to work when building at
-O0 but not above. This was only detected in the HTTP/2 parser, but in
mainline it could only affect the integer to binary sample cast.
No backport is needed since this bug was only introduced in the development
branch.
This commit is contained in:
parent
9130a9605d
commit
dea7c5c03d
@ -1202,7 +1202,7 @@ static inline unsigned char utf8_return_length(unsigned char code)
|
||||
static inline unsigned long long my_htonll(unsigned long long a)
|
||||
{
|
||||
#if defined(__x86_64__)
|
||||
__asm__ volatile("bswap %0" : "=r"(a));
|
||||
__asm__ volatile("bswap %0" : "=r"(a) : "0"(a));
|
||||
return a;
|
||||
#else
|
||||
union {
|
||||
|
Loading…
Reference in New Issue
Block a user