Skip to content

PyArray_Ravel unchecked in iterators.h init_iter_all — NULL dereference and ref leak #528

@devdanzin

Description

@devdanzin

Four calls to PyArray_Ravel in init_iter_all / the ravel-based init paths (iterators.h:133-146) store the result without checking for NULL. If PyArray_Ravel fails, PyArray_DIM(NULL, 0) dereferences NULL. The old a reference is also leaked (same pattern as the nonreducer_axis Ravel leak in #521).

These functions return void, so the fix requires either refactoring to return an error indicator or having callers check after init_iter_all.

File(s): iterators.h:133-135, 144-146

See #518 for the complete report.

Found using cext-review-toolkit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions