Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http_aws_sigv4: fix sorting with empty parts #11868

Closed
wants to merge 1 commit into from

Conversation

dfandrich
Copy link
Contributor

When comparing with an empty part, the non-empty one is always
considered greater-than. Previously, the two would be considered equal
which would randomly place empty parts amongst non-empty ones.

Fixes #11855
Closes #11868

When comparing with an empty part, the non-empty one is always
considered greater-than. Previously, the two would be considered equal
which would randomly place empty parts amongst non-empty ones.

Fixes #11855
Closes #11868
Copy link
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

if(aa->len == 0)
return -1;
if(bb->len == 0)
return 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a second I thought this might need a special case for when both lengths are zero, but I doubt that is true. This code should make the sorting stable and working nonetheless.

@dfandrich dfandrich closed this in c879203 Sep 16, 2023
@dfandrich dfandrich deleted the dfandrich/awscmp branch September 16, 2023 15:36
ptitSeb pushed a commit to wasix-org/curl that referenced this pull request Sep 25, 2023
When comparing with an empty part, the non-empty one is always
considered greater-than. Previously, the two would be considered equal
which would randomly place empty parts amongst non-empty ones. This
showed as a test 439 failure on Solaris as it uses a different
implementation of qsort() that compares parts differently.

Fixes curl#11855
Closes curl#11868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

AWS signature test fails on Solaris
2 participants