-
Notifications
You must be signed in to change notification settings - Fork 21
[MOD-11650] Fix Out-of-Bounds Write in Vector Preprocessing #784
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6a1b1a4
rename dataSize->getStoredDataSize
meiravgri 9860204
missing rename
meiravgri b4143aa
format
meiravgri b3b735a
add input blob size to AbstractIndexInitParams
meiravgri ea00886
try sanitizer
meiravgri f03e559
run sanitizer
meiravgri aad4b0c
runanyway
meiravgri 766a412
rervt task unit test
meiravgri 8dfb610
fix leak in input bob size
meiravgri f011d43
fix int8/uint8 elementSizeEstimation tests
meiravgri 5b93332
run codecov with sanitizer (also intek)
meiravgri ff1e318
some fixes and assertion
meiravgri 6827d65
fix uint8
meiravgri a11d342
fix again
meiravgri 580443d
fix possible warning abour divison by zero by checking quantBits with…
meiravgri af844ec
TO REVERT!
meiravgri 9cff30c
Revert "TO REVERT!"
meiravgri 8b5bcd5
rever ci changes
meiravgri 2f979ed
calculate EstimateElementSize accroding to the stored vector size
meiravgri 2296850
revert unrelated change in cmake.san
meiravgri c0443da
add batch itertor blob correctness to int8 tests
meiravgri 74e4fef
apply suggesting
meiravgri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2006-Present, Redis Ltd. | ||
* All rights reserved. | ||
* | ||
* Licensed under your choice of the Redis Source Available License 2.0 | ||
* (RSALv2); or (b) the Server Side Public License v1 (SSPLv1); or (c) the | ||
* GNU Affero General Public License v3 (AGPLv3). | ||
*/ | ||
#pragma once | ||
|
||
#include "VecSim/vec_sim_index.h" | ||
|
||
namespace VecSimFactory { | ||
template <typename IndexParams> | ||
static AbstractIndexInitParams NewAbstractInitParams(const IndexParams *algo_params, void *logCtx, | ||
bool is_input_preprocessed) { | ||
|
||
size_t storedDataSize = | ||
VecSimParams_GetStoredDataSize(algo_params->type, algo_params->dim, algo_params->metric); | ||
|
||
// If the input vectors are already processed (for example, normalized), the input blob size is | ||
// the same as the stored data size. inputBlobSize = storedDataSize Otherwise, the input blob | ||
// size is the original size of the vector. inputBlobSize = algo_params->dim * | ||
// VecSimType_sizeof(algo_params->type) | ||
size_t inputBlobSize = is_input_preprocessed | ||
? storedDataSize | ||
: algo_params->dim * VecSimType_sizeof(algo_params->type); | ||
AbstractIndexInitParams abstractInitParams = {.allocator = | ||
VecSimAllocator::newVecsimAllocator(), | ||
.dim = algo_params->dim, | ||
.vecType = algo_params->type, | ||
.storedDataSize = storedDataSize, | ||
.metric = algo_params->metric, | ||
.blockSize = algo_params->blockSize, | ||
.multi = algo_params->multi, | ||
.logCtx = logCtx, | ||
.inputBlobSize = inputBlobSize}; | ||
return abstractInitParams; | ||
} | ||
} // namespace VecSimFactory |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.