Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

chroma-core/hnswlib
master @ 6868102
2
Fixes
1
CVEs
HIGH
Peak severity
100.0%
Coverage
Highlights
Integer Overflow: 1 prior fix. Scrutinize any change in this area.
hnswlib/hnswalg.h: most-fixed (1 issue). Treat as high-risk during review.
1 high-severity fix in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Integer Overflow: Buffer size and offset calculations utilizing 32-bit 'unsigned int' variables are vulnerable to integer overflows when processing extremely large index datasets, leading to corrupted heap memory copies via memcpy. Developers must ensure type widening to 64-bit size types (such as size_t) for all offset and buffer size evaluations.
Out-of-bounds Read: An incorrect off-by-one lower-bound check ('<= 0' instead of '< 0') on index validation in the core HNSW algorithm caused valid 0-th indices to trigger logic errors or out-of-bounds read conditions. Precision in index boundary checking is highly critical in low-level header logic.
Double Free: Improper handling of large integer arguments (such as the 'M' hyperparameter) in 'init_index' can cause double free conditions during cleanup phases, risking application crashes or arbitrary code execution. This highlights the importance of safe resource deallocation during initialization failure paths.