Fix crash when accessing already cleared memory in the sorting module#7195
Merged
dyemanov merged 2 commits intoFirebirdSQL:masterfrom Jun 1, 2022
Merged
Conversation
Fix crash when accessing already cleared memory. In the following case: - specific record size; - the maximum size of the allocated map buffer is greater than MAX_SORT_BUFFER_SIZE; - unable to allocate memory in dbb_permament pool, throw BadAlloc exception; - buffer of size MAX_SORT_BUFFER_SIZE must be allocated in the owner's pool. In the Sort::releaseBuffer procedure, the allocated buffer goes into the dbb_sort_buffers cache. After the request is completed, the owner's pool is cleared and the pointer in dbb_sort_buffers cache will be corrupted. The next request, which will take the buffer from cache, throw with error.
Member
|
Could you create a ticket with description as above, please ? Also, am I correct that the bug happens if |
hvlad
approved these changes
May 30, 2022
hvlad
reviewed
May 30, 2022
dyemanov
approved these changes
May 30, 2022
Member
Pull request is a ticket too, no need to create both. Just put labels on it. |
Contributor
Author
Yes that's right, when n > 0 |
Member
|
I will backport to other versions a bit later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix crash when accessing already cleared memory. In the following case:
In the Sort::releaseBuffer procedure, the allocated buffer goes into the dbb_sort_buffers cache.
After the request is completed, the owner's pool is cleared and the pointer in dbb_sort_buffers cache will be corrupted. The next request, which will take the buffer from cache, throw with error.