summaryrefslogtreecommitdiff
path: root/docs/examples/multithread.c
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2024-12-19 02:09:57 +0800
committerDaniel Stenberg <daniel@haxx.se>2024-12-18 23:30:39 +0100
commit87d9e5405a7e634b01031699ebb20fd02cb01db2 (patch)
tree68dd9fa5987bd982b985b59e3bc0cd2aa4d8464e /docs/examples/multithread.c
parent302bd6b385b3b73e52ce9a2cd25ef626b1b0fcac (diff)
http_aws_sigv4: Fix invalid compare function handling zero-length pairs
The compare_func() can violate the antisymmetric property required by qsort. Specifically, when both aa->len == 0 and bb->len == 0, the function returns conflicting results (-1 for compare_func(a, b) and -1 for compare_func(b, a)). This violates the rules of qsort and may lead to undefined behavior, including incorrect sorting or memory corruption in glibc [1]. Add a check to return 0 when both lengths are zero, ensuring proper behavior and preventing undefined behavior in the sorting process. Ref: https://www.qualys.com/2024/01/30/qsort.txt [1] Closes #15778
Diffstat (limited to 'docs/examples/multithread.c')
0 files changed, 0 insertions, 0 deletions