NR gNB MAC: read only the Buffer Size fields present in a Long BSR #1044
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 199 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.317
Real PR Conversation Timeline
1 comments
"Review active on #1044"
general
weight: 0.35
antcybersec
estimate_ul_buffer_long_bsr()reads one Buffer Size octet for every LCGi bit set in the bitmap, without looking at the length L of the MAC CE.TS 38.321 §6.1.3.1: in a Long Truncated BSR (used by UEs for padding BSRs), LCGi = 1 indicates that the LCG has data available, but the number of Buffer Size fields is bounded by the available space ("maximised, while not exceeding the number of padding bits"). There can therefore be fewer Buffer Size fields than bits set in the bitmap. The gNB read the subsequent octets (typically padding
0x3f) as buffer sizes, causing massive UL over-granting. Additionally, a Long BSR with L = 0 at the end of a PDU caused reads beyond the PDU buffer.Changes:
estimate_ul_buffer_long_bsr()and only read Buffer Size fields present within the CE bounds (m < num_bs).mac_len == 0(no bitmap octet), log an error and skip processing rather than reading out-of-bounds.Tested:
Evaluated
estimate_ul_buffer_long_bsr()on Long Truncated BSR test cases before and after the fix:| MAC CE (followed by padding
0x3f) | Expected | develop | This PR ||---|---|---|---|
| Long BSR, LCG0+LCG1, BS indexes 10, 20 (L = 3) | 58 | 58 | 58 |
| Long Truncated BSR, LCG0+LCG1, one BS index 10 (L = 2) | 20 | 580 | 20 |
| Long Truncated BSR, all LCGs, no BS field (L = 1) | 0 | 4480 | 0 |
Built with ASan+UBSan (aarch64) with no new warnings; all gNB MAC unit tests (
test_nr_mac_gnb) pass.