Skip to content
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

Fix illegal pointer reference in LookupKey #9

Merged
merged 1 commit into from
Feb 3, 2018
Merged

Conversation

sunchao
Copy link
Owner

@sunchao sunchao commented Feb 3, 2018

In the LookupKey struct we currently allocate fixed length array on
stack if the key size is small enough, and then store the pointer to the
array. This, however, will fail since later on the array will be moved
to an new address, but the pointer is still referring to the old memory
location!

It seems dangerous to operate on the pointer in this case. This commit
changes LookupKey to allocate the array on heap in all cases. We shall
see how the performance impact of this is, and come back later if
necessary.

In the LookupKey struct we currently allocate fixed length array on
stack if the key size is small enough, and then store the pointer to the
array. This, however, will fail since later on the array will be moved
to an new address, but the pointer is still referring to the old memory
location!

It seems dangerous to operate on the pointer in this case. This commit
changes LookupKey to allocate the array on heap in all cases. We shall
see how the performance impact of this is, and come back later if
necessary.
@sunchao sunchao merged commit baabfbd into master Feb 3, 2018
@sunchao sunchao deleted the fix-lookupkey branch February 3, 2018 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant