Skip to content

enforce buffer_constraints size matches dimensions in Parameter ctor - #9312

Merged
alexreinking merged 1 commit into
halide:mainfrom
Nashit-h:parameter-buffer-constraints-dim-check
Aug 14, 2026
Merged

enforce buffer_constraints size matches dimensions in Parameter ctor#9312
alexreinking merged 1 commit into
halide:mainfrom
Nashit-h:parameter-buffer-constraints-dim-check

Conversation

@Nashit-h

Copy link
Copy Markdown
Contributor

The buffer Parameter reconstruction constructor takes buffer_constraints verbatim but reads dimensions from a separate argument, so a serialized pipeline declaring more dimensions than it has constraints for leaves the vector shorter than dimensions(). check_dim_ok() only bounds a dimension index against dimensions(), so stride_constraint/min_constraint/extent_constraint (reached from AddImageChecks during lowering) then index buffer_constraints past its end and read adjacent heap memory as Expr handles. Require the sizes to agree in the constructor, the invariant every other Parameter constructor already maintains.

Checklist

  • Tests added or updated (not required for docs, CI config, or typo fixes)
  • Documentation updated (if public API changed)
  • Python bindings updated (if public API changed)
  • Benchmarks are included here if the change is intended to affect performance.
  • Commits include AI attribution where applicable (see Code of Conduct)

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.94%. Comparing base (d3da666) to head (a7596ef).

Files with missing lines Patch % Lines
src/Parameter.cpp 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9312      +/-   ##
==========================================
+ Coverage   69.92%   69.94%   +0.02%     
==========================================
  Files         258      258              
  Lines       78206    78209       +3     
  Branches    19036    19037       +1     
==========================================
+ Hits        54684    54707      +23     
+ Misses      17804    17803       -1     
+ Partials     5718     5699      -19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alexreinking
alexreinking merged commit 0553ba8 into halide:main Aug 14, 2026
26 of 27 checks passed
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.

3 participants