Skip to content

Fix GH-19300: Nested array_multisort invocations break #19319

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

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

There are 2 issues:

  1. When a MULTISORT_ABORT happens, it frees func, but func may point to ARRAYG(multisort_func), which would be a problem with nested invocations as it can destroy that of the "parent" invocation. To solve this, delay assigning to the globals.
  2. The old globals were not restored which means that nested invocations with different flags will cause a wrong sorting function to be used.

There are 2 issues:
1. When a MULTISORT_ABORT happens, it frees func, but func may point to
   ARRAYG(multisort_func), which would be a problem with nested
   invocations as it can destroy that of the "parent" invocation.
   To solve this, delay assigning to the globals.
2. The old globals were not restored which means that nested invocations
   with different flags will cause a wrong sorting function to be used.
@nielsdos nielsdos requested a review from bukka as a code owner July 30, 2025 17:06
@nielsdos nielsdos linked an issue Jul 30, 2025 that may be closed by this pull request
@nielsdos nielsdos changed the title Fix GH-19300: Nested array_multisort invocation with error breaks Fix GH-19300: Nested array_multisort invocations break Jul 30, 2025
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Looks correct to me

@nielsdos nielsdos closed this in a96b05e Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested array_multisort invocation with error breaks
2 participants