Skip to content

Security: Index.get returns uninitialized memory for non-existent keys using python bindings #663

@titusz

Description

@titusz

Describe the bug

See: #494
Created a new issue here due to potential security implications.

Steps to reproduce

from usearch.index import Index
import numpy as np

index = Index(ndim=3)
index.add(1, np.array([0.1, 0.2, 0.3]))

print(f"Existent Key 1: {index.get(1)}")      # Works
print(f"Non-Existent Key 999: {index.get(999)}")  # Bug: returns garbage instead of None

Expected behavior

Return None for non-existent keys

USearch version

v2.21.0

Operating System

Windows 10

Hardware architecture

x86

Which interface are you using?

Python bindings

Contact Details

tp@iscc.io

Are you open to being tagged as a contributor?

  • I am open to being mentioned in the project .git history as a contributor

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions