← Back to Pull requests

libbz2-rs-sys: pass byte counts to custom allocators as (n, 1), like libbzip2 #149

Open
sergiodj opened this pull request with 36 lines diff across 2 files
View on GitHub
sergiodj sergiodj commented on Nov 04, 2026 01:51 UTC
Author

libbzip2 requests every block through BZALLOC(nnn), which calls bzalloc(opaque, nnn, 1). libbz2-rs-sys calls bzalloc(opaque, count, size_of::<T>()) instead, so an allocator written against the C library -- one that honours only the second argument, which the C library's calls have always allowed -- returned count bytes for a block of count size_of::<T>() bytes.

This patch passes the byte count (i.e., items size) as items and size as 1. A count that does not fit the C int fails like a NULL return.

Disclaimer: an LLM model was used to verify the patch's correctness. It also generated a reproducer for the issue which I'll be happy to post if necessary.

Diff: 36 lines (+29 / -7) across 2 files Reviewer: None requested Review duration: 45023m
All Vouch review confidence checks passed
Residual risk 0.31 = Change Risk (0.50) × (1 − Review Confidence (0.38)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 36 lines diff across 2 files
0.50
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 10%
38%
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
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.216
No Reviewer Assigned no_reviewer_assigned
0.120
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #149"
general weight: 0.35
Reviewers
None requested
Assignees
sergiodj sergiodj
Labels
risk: low confidence: 38.5% 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.1% (MEDIUM) · Higher = larger blast radius
50.1%
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: 38.5% · Lower = rushed or shallow review
38.5%
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: 30.8% · Safe to merge
30.8%