Fix memcpy of id from key to be slightly safer.#6645
Merged
antirez merged 1 commit intoredis:unstablefrom Dec 5, 2019
eliblight:fix-memcpy
Merged
Fix memcpy of id from key to be slightly safer.#6645antirez merged 1 commit intoredis:unstablefrom eliblight:fix-memcpy
antirez merged 1 commit intoredis:unstablefrom
eliblight:fix-memcpy
Conversation
+ memcpy(&id,ri.key,sizeof(id)); The memcpy from the key to the id reliease on the fact that this key *should* be 8 bytes long as it was entered as such a few lines up the code. BUT if someone will change the code to the point this is no longer true, current code can trash the stack which makes debugging very hard while this fix will result in some garbage id, or even page fault. Both are preferable to stack mangaling.
Contributor
|
Thanks @eliblight, merged. |
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Dec 24, 2019
Fix memcpy of id from key to be slightly safer.
oshadmi
added a commit
to oshadmi/redis
that referenced
this pull request
Sep 28, 2025
$ gitlog v8.2.1..v8.2.5 redis#6867 Improve BUILD_INTEL_SVS_OPT flag validation redis#6845 Fix vector compression type reporting and rename SVS environment variable redis#6794 Fix rpcountFree casting redis#6825 Bump vecsim 8.2.4 redis#6787 Fix deadlock while RDB loading and RM_Yield (redis#6763) redis#6723 Fix ACLUserMayAccessIndex redis#6701 Fix fd leak when OOM redis#6676 bump svs version redis#6671 Add SVS-VAMANA index to info fields telemetry redis#6665 Optimize rs_wall_clock_diff_ns by removing redundant if branch redis#6641 Update vectors memory in total index info memory redis#6634 Log DocTable capacity growth for memory diagnostics redis#6649 Bump minimal redis version redis#6648 Fix "has map" performance redis#6645 Trie: hide expensive memory usage computation behind a test-specific feature flag.
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.
The memcpy from the key to the id relies on the fact that this key
should be 8 bytes long as it was entered as such a few lines up the
code.
BUT if someone will change the code to the point this is no longer true,
current code can trash the stack which makes debugging very hard
while this fix will result in some garbage id, or even page fault.
Both are preferable to stack mangaling.