GH-55400: [C++][IPC] Validate ReadMessage body_length #55382
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 177 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.310
Real PR Conversation Timeline
1 comments
"Review active on #55382"
general
weight: 0.35
raulcd
Rationale for this change
The public IPC message readers need to reject invalid body lengths before arithmetic or IO. This addresses #55400.
What changes are included in this PR?
In
cpp/src/arrow/ipc/message.cc,ReadMessageInternalandReadMessageAsyncreturnInvalidfor negative body lengths or a metadata-plus-body length that exceeds the signed 64-bit range. The rebase preserves the newer upstream file-size and field-loading checks. The synchronous guard runs beforeCheckBodyLength.Are these changes tested?
ReadMessageValidBodyLengthandReadMessageInvalidBodyLengthincpp/src/arrow/ipc/message_internal_test.cccover valid reads and rejection in both reader APIs.Are there any user-facing changes?
Invalid body lengths return
Invalid. Valid calls retain the existing behavior. No public API signature changes.Was AI used for this PR?
The existing human-authored contribution used AI assistance. AI assisted this rebase, source review and validation.
PR code and description written by:
Reviewed before submission by:
How was this patch generated?
AI assistance reapplied the existing guards and tests to current main and retained the upstream checks.
AI assistance was used in drafting and validating this change; the patch and tests were reviewed and verified by the author.