Skip to content

fix(autoresearch): validate buffer sizes in fl_parlio_measure (meta #2580 C1) - #2585

Merged
zackees merged 1 commit into
masterfrom
fix/2580-parlio-measure-bounds
May 30, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2580-parlio-measure-bounds

Conversation

@zackees

@zackees zackees commented May 30, 2026 •

Copy link
Copy Markdown
Member

Summary

fl_parlio_measure ignored its scratch_size/output_size parameters ((void)-cast) but the inner loop indexes scratch[lane*768+offset] (requires 16*768 bytes) and output[offset*16*sizeof(Wave8Byte)+127]. An undersized buffer silently corrupted memory.

Adds an early-return + FL_WARN (or equivalent) with the required sizes; drops the (void) casts.

Addresses meta-issue #2580 finding C1 (originally CodeRabbit on #2547 — #2547 (review)).

Test plan

  • bash lint
  • CI green

Summary by CodeRabbit

  • Bug Fixes
    • Improved buffer validation in measurement operations to properly check provided buffer sizes and log warnings when insufficient capacity is detected, preventing incomplete measurements.

Review Change Stack

fl_parlio_measure ignored scratch_size/output_size (cast to void) but
the inner loop indexes scratch[lane*768+offset] and
output[offset*16*sizeof(Wave8Byte)+127]. An undersized buffer silently
corrupted memory. Add an early-return + FL_WARN with the required sizes;
drop the (void) casts.

Addresses CodeRabbit finding C1 from meta #2580 (originally #2547).
@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5e304c49-2530-4390-9a7f-a95b9c443576

📥 Commits

Reviewing files that changed from the base of the PR and between a109faa and bea58e4.

📒 Files selected for processing (1)
  • examples/AutoResearch/AutoResearchParlioEncode.h

📝 Walkthrough

Walkthrough

The fl_parlio_measure function in examples/AutoResearch/AutoResearchParlioEncode.h now validates provided scratch and output buffer sizes before measurement. The change adds header support for logging and implements early-return validation that emits a warning if buffers are insufficient.

Changes

Parlio Measurement Buffer Validation

Layer / File(s) Summary
Buffer size validation and logging
examples/AutoResearch/AutoResearchParlioEncode.h
Added fl/log/log.h include for FL_WARN support. Updated fl_parlio_measure to compute required scratch/output sizes, validate provided buffer sizes, log a warning on undersized buffers, and return 0u early instead of proceeding with the benchmark loop.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A buffer guard hops into place,
With warnings logged at just the right grace,
Scratch and output sizes checked with care,
No measure mishaps hiding anywhere! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding buffer size validation in fl_parlio_measure to fix a bounds checking bug.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2580-parlio-measure-bounds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zackees
zackees merged commit 0a04bda into master May 30, 2026
5 of 6 checks passed
@zackees
zackees deleted the fix/2580-parlio-measure-bounds branch May 30, 2026 20:02
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