Merged
Conversation
philippwerner
approved these changes
Apr 13, 2026
Contributor
philippwerner
left a comment
There was a problem hiding this comment.
Thanks! These are some very good finds!
src/common_buffers.h
Outdated
| subBufferSize = size; | ||
| subBufferPtr = (unsigned char**)buffer; | ||
| subBufferLock = (volatile char*)(buffer + ptrSize); | ||
| setMem((void*)subBufferLock, lockSize, 0); |
Contributor
There was a problem hiding this comment.
This isn't needed, because allocPoolWithErrorLog() initializes the buffer with 0 already.
src/common_buffers.h
Outdated
| constexpr unsigned long long defaultCommonBuffersSize = math_lib::max(MAX_CONTRACT_STATE_SIZE, math_lib::max(spectrumSizeInBytes, universeSizeInBytes)); | ||
| constexpr unsigned long long spectrumSizeInBytes = SPECTRUM_CAPACITY * sizeof(EntityRecord); | ||
| constexpr unsigned long long universeSizeInBytes = ASSETS_CAPACITY * sizeof(AssetRecord); | ||
| constexpr unsigned long long defaultCommonBuffersSize = math_lib::max(MAX_CONTRACT_STATE_SIZE, math_lib::max(spectrumSizeInBytes, universeSizeInBytes)); |
Contributor
There was a problem hiding this comment.
Please avoid these diffs (also see setMem(ptr, size, 0); before) that are due to whitespace changes only in future bugfix/feature PRs. I usually build my commit with git add -p to avoid including such things.
Code reformatting ideally should be done in extra PRs.
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.
This PR fixes three bugs
src/logging/net_msg_impl.hremoval of a double sizeof operator which always returns 8src/common_buffers.hConsequently use bytes as locks forsubBufferLocksto avoid race conditions and overwritting of OOB memorysrc/contract_core/qpi_collection_impl.hAddstackBytesto allocation to avoid writing to uninitialized and potentially used memory