Skip to content

Fix spurious "short buffer" warnings during message decode#1223

Merged
kixelated merged 1 commit into
mainfrom
debug-short-buffer
Apr 6, 2026
Merged

Fix spurious "short buffer" warnings during message decode#1223
kixelated merged 1 commit into
mainfrom
debug-short-buffer

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Summary

  • The non-trace decode path in both lite/message.rs and ietf/message.rs was missing a buf.remaining() < size early-return guard that existed in the trace path
  • Without it, decode_msg was called with an undersized take(size) buffer, returned DecodeError::Short, and logged a warning — even though the Reader correctly handles Short by buffering more data and retrying
  • Added the missing guard so Short is returned silently (as expected), matching the trace path behavior

Test plan

  • cargo check -p moq-lite passes
  • Verify warning spam is gone when running moq-relay with a connected client

🤖 Generated with Claude Code

The non-trace decode path was missing the buf.remaining() < size guard
that exists in the trace path. Without it, decode_msg would be called
with an undersized take(size) buffer, produce DecodeError::Short, and
log a warning — even though it's just normal incremental buffering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kixelated kixelated enabled auto-merge (squash) April 6, 2026 21:08
@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5d55b833-8006-4c5d-ad82-b293a0b344b1

📥 Commits

Reviewing files that changed from the base of the PR and between b6369d9 and 129cfb6.

📒 Files selected for processing (2)
  • rs/moq-lite/src/ietf/message.rs
  • rs/moq-lite/src/lite/message.rs

Walkthrough

The changes add bounds validation in the non-tracing code paths for message decoding across two modules. Before creating a limited buffer view with buf.take(size), the code now explicitly checks if buf.remaining() < size and returns DecodeError::Short when insufficient bytes remain. This ensures the non-tracing control flow matches the tracing-enabled path behavior.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix spurious "short buffer" warnings during message decode' directly and clearly summarizes the main change: adding guards to prevent spurious warnings when buffers are short but the Reader handles retries correctly.
Description check ✅ Passed The description is related to the changeset, explaining the root cause (missing bounds check in non-trace path), the impact (spurious warnings), and the fix (adding the guard to match trace path behavior).

✏️ 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 debug-short-buffer
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch debug-short-buffer

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.

@kixelated kixelated merged commit fdb139d into main Apr 6, 2026
2 checks passed
@kixelated kixelated deleted the debug-short-buffer branch April 6, 2026 21:31
This was referenced Apr 4, 2026
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