Skip to content

FIX curropted object array issue - #566

Merged
adrinjalali merged 2 commits into
mainfrom
object-array-shape-check
Nov 15, 2026
Merged

adrinjalali merged 2 commits into
mainfrom
object-array-shape-check

Conversation

@adrinjalali

Copy link
Copy Markdown
Member

Fixes a reported attack.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human validation against the original exploit and supported NumPy versions is needed because the reported attacker-controlled object-array payload and its details are unavailable.

No open issues 🎉

What changed in this PR

This PR hardens NumPy object-array loading against corrupted or malicious files by validating saved items against the declared shape before allocating the array.

Changes:

  • Validate dimensions, nested-list lengths, and shared structural lists before allocation.
  • Populate validated arrays in flat order.
  • Add regression tests for malformed shapes, aliased rows, and allocation limits, including empty arrays.
File Description
skops/​io/​tests/​test_audit.py Adds malformed-array rejection and memory-allocation regression tests.
skops/​io/​_numpy.py Validates object-array contents before allocation and updates cell assignment.

Review effort: Balanced

@adrinjalali
adrinjalali merged commit 01e0ac1 into main Nov 15, 2026
57 checks passed
@adrinjalali
adrinjalali deleted the object-array-shape-check branch November 15, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants