← Back to Pull requests

fix(ipc): Reject fields that share a dictionary with different value types #989

Open
pedrobtz opened this pull request with 98 lines diff across 2 files
View on GitHub
pedrobtz pedrobtz commented on Oct 21, 2026 22:00 UTC
Author

ArrowIpcDictionariesInit() supports several fields sharing one dictionary id. It makes one ArrowIpcDictionary per unique id and decodes its batches with the value type of the first field that has that id. Nothing checks that the other fields with the id have the same value type. If they don't, ArrowIpcDecoderWalkSetArrayView() views the decoded dictionary with the second field's type.

For a string dictionary read by a field whose values are large_string, the 4-byte offsets are read as 8-byte ones. ASan reports a heap-buffer-overflow in ArrowArrayViewValidateDefault(). ArrowIpcArrayStreamReader hits this on a schema message with two such fields, followed by a dictionary batch and a record batch.

ArrowIpcDictionariesInit() now returns EINVAL when two fields share an id but not a value type. The comparison covers formats, children and nested dictionaries, not names, flags or metadata. Shared dictionaries with the same value type work as before.

The new NanoarrowIpcSharedDictionaryValueTypes test initialises dictionaries for two fields with id 0, first both string, then string and large_string. It expects success and then EINVAL. Without the fix the second case succeeds. I also read the stream that crashed through ArrowIpcArrayStreamReader. It now fails with the new message instead of reading out of bounds.

Found by fuzzing the IPC reader in the zuarrow R package, which vendors nanoarrow.

ctest passes in a plain Debug build and with ASan and UBSan (410 tests each). The changed files are formatted with the pinned clang-format 16.0.6.

🤖 Generated with Claude Code

Diff: 98 lines (+98 / -0) across 2 files Reviewer: None requested Review duration: 61068m
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.51) × (1 − Review Confidence (0.65)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.51 · 98 lines diff across 2 files
0.51
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.58 · 1 substantive comment(s)
0.58
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
64%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Diff Size diff_size
0.275
No Reviewer Assigned no_reviewer_assigned
0.120
Real PR Conversation Timeline
2 items
codecov-commenter codecov-commenter commented on Oct 26, 2026 03:47 UTC
Contributor

Codecov Report


:x: Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 78.56%. Comparing base (08d23f6) to head (4e3bc4c).

| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/nanoarrow/ipc/decoder.c | 78.94% | 1 Missing and 3 partials :warning: |

<details><summary>Additional details and impacted files</summary>

@@            Coverage Diff             @@
##             main     #989      +/-   ##
==========================================
+ Coverage   78.52%   78.56%   +0.04%     
==========================================
  Files         106      106              
  Lines       17195    17214      +19     
  Branches     2064     2070       +6     
==========================================
+ Hits        13502    13525      +23     
+ Misses       2431     2426       -5     
- Partials     1262     1263       +1     

</details>

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>

  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

  • </details>

    Reviewers
    None requested
    Assignees
    pedrobtz pedrobtz
    Labels
    risk: low confidence: 64.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.9% (MEDIUM) · Higher = larger blast radius
    50.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 64.6% · Lower = rushed or shallow review
    64.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%