Skip to content

Commit f851c54

Browse files
generatedunixname4593378654225212meta-codesync[bot]
authored andcommitted
large-malloc (6241124352 bytes) in __sanitizer::RunMallocHooks() (facebookresearch#4977)
Summary: Pull Request resolved: facebookresearch#4977 Reviewed By: limqiying Differential Revision: D97904239 fbshipit-source-id: 46fb32f1a37f67de39813c30e69af775078546c1
1 parent c048917 commit f851c54

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

faiss/impl/index_read.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,11 @@ std::unique_ptr<Index> read_index_up(IOReader* f, int io_flags) {
12121212
auto idxr = std::make_unique<ResidualCoarseQuantizer>();
12131213
read_index_header(*idxr, f);
12141214
read_ResidualQuantizer(idxr->rq, f, io_flags);
1215+
FAISS_THROW_IF_NOT_MSG(
1216+
static_cast<size_t>(idxr->ntotal) <
1217+
get_deserialization_vector_byte_limit() / sizeof(float),
1218+
"ResidualCoarseQuantizer centroid_norms allocation would exceed "
1219+
"deserialization byte limit");
12151220
READ1(idxr->beam_factor);
12161221
if (io_flags & IO_FLAG_SKIP_PRECOMPUTE_TABLE) {
12171222
// then we force the beam factor to -1

0 commit comments

Comments
 (0)