Skip to content

Reject out-of-range index-matrix fill values - #4977

Closed
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/validate-index-matrix-fill-range
Closed

Reject out-of-range index-matrix fill values#4977
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/validate-index-matrix-fill-range

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

tracks_to_index_matrix() validates that fill_value is a negative integer, but did not validate that it is representable by the integer matrix it allocates. A value below numpy.iinfo(numpy.int64).min therefore passed the public validation and failed later inside the backend allocator with a raw OverflowError.

For example, fill_value=numpy.iinfo(numpy.int64).min - 1 reached numpy.full(..., dtype=int) and raised OverflowError: Python int too large to convert to C long.

Fix

  • reject negative fill values below the int64 range with a deterministic ValueError;
  • preserve the valid int64 minimum boundary;
  • add regression coverage for both the immediate underflow case and a much larger negative Python integer.

Validation

  • reproduced the pre-fix OverflowError through the current module in an isolated NumPy-backend harness;
  • the patched focused test module passes all three index-matrix tests;
  • syntax compilation passes for both modified files;
  • branch comparison is limited to two files: 3 source lines and 23 regression-test lines.

The repository's pull-request workflows provide the full supported Python/backend, lint, packaging, documentation, and security validation matrix.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 27.81s
✅ JSON prettier 7 0 0 0 1.14s
✅ JSON v8r 7 0 0 4.76s
✅ MARKDOWN markdownlint 68 0 0 0 1.95s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.81s
✅ PYTHON black 1809 56 0 0 94.96s
✅ PYTHON isort 1809 88 0 0 2.88s
✅ REPOSITORY betterleaks yes no no 2.39s
✅ REPOSITORY checkov yes no no 56.86s
✅ REPOSITORY gitleaks yes no no 17.37s
✅ REPOSITORY git_diff yes no no 0.45s
✅ REPOSITORY secretlint yes no no 78.91s
✅ REPOSITORY syft yes no no 6.07s
✅ REPOSITORY trivy-sbom yes no no 6.34s
✅ REPOSITORY trufflehog yes no no 33.59s
✅ YAML prettier 11 0 0 0 0.87s
✅ YAML v8r 11 0 0 12.37s
✅ YAML yamllint 11 0 0 0.57s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Copy link
Copy Markdown
Owner Author

Closing as low value. This only changes the exception produced for an already-invalid integer sentinel outside the representable int64 range. Supported sentinel values are unaffected, so the maintenance and test surface is not justified by practical user impact.

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.

1 participant