]> git.ipfire.org Git - thirdparty/openssl.git/commit
Don't clear is_sorted unconditionally on OPENSSL_sk_insert()
authorBob Beck <beck@openssl.org>
Fri, 12 Sep 2025 18:08:02 +0000 (12:08 -0600)
committerPauli <paul.dale@oracle.com>
Wed, 17 Sep 2025 21:30:23 +0000 (07:30 +1000)
commita7540121b5ff0d42333d563bb16ee74bf466bb75
tree24c918e39cfd1a2ae988eb614ad7c0eb21de7c47
parenta1f6bbf6b0eb5bd15569b225bb0bd443fa879c9c
Don't clear is_sorted unconditionally on OPENSSL_sk_insert()

If we have a comparison function, and the array was sorted,
check to see if we are inserting in the correct location.
if so do not clear is_sorted.

This allows for element locations found with OPENSSL_sk_find_ex
to be used to insert elements in the correct location and preserve
the sorting order without the need to sort the stack again.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28533)
crypto/stack/stack.c
test/stack_test.c