Skip to content

P0 MMS Reporting: fail closed on zero-payload BIT STRING underflow - #213

Merged
masarray merged 2 commits into
mainfrom
fix/report-bitstring-unsigned-underflow-20261017
Oct 17, 2026
Merged

masarray merged 2 commits into
mainfrom
fix/report-bitstring-unsigned-underflow-20261017

Conversation

@masarray

Copy link
Copy Markdown
Owner

Confirmed root cause

src/mms/reporting.cpp:decode_bit_field on current main computed (raw.size()-1)*8 - unused with size_t. Header-only MMS BIT STRING with 1..7 unused bits has zero payload and underflows to a huge iteration bound, indexing beyond the received frame buffer. This is a network-originated malformed-input safety issue.

Fix

  • Validate unused-bit count does not exceed actual payload bits before subtraction or byte indexing; throw existing MmsReportingFormatError.
  • Preserve normal padded nonempty BIT STRING decoding and existing report state machine.
  • Add deterministic malformed OptFlds and inclusion-vector regression for unused counts 1 and 7, plus valid padded report control.

Scope and provenance

Two core files only; no alternate decoder, GUI workaround, thread, packet format or breaking API. Rediscovered while auditing old unmerged draft #133; deliberately applied the focused patch to today's main rather than force-merging the stale draft.

Gates

Require exact-head C++ core/reporting + sanitizers (if triggered), CI and clean review before merge. Physical vendor interoperability remains separately unverified.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T01:34:06.394382Z ddacad7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@masarray
masarray merged commit 5b8b0b9 into main Oct 17, 2026
25 checks passed
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