Skip to content

Avx2Searcher also read beyond the end of the haystack #97

Open
@Xyah3PBeHB

Description

@Xyah3PBeHB

sliceslice-rs/src/lib.rs

Lines 200 to 209 in f8d9375

unsafe fn vector_search_in_chunk<N: NeedleWithSize + ?Sized, V: Vector>(
needle: &N,
position: usize,
hash: &VectorHash<V>,
start: *const u8,
mask: u32,
) -> bool {
let first = V::load(start);
let last = V::load(start.add(position));

V::load(start.add(position)) will read memory from start + position to start + position + V::LANES, but chunk only make sure start + V::LANES <= end instead of start + position + V::LANES <= end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions