Skip to content

DSC: sparse frame with a non-numeric sender MMSI slips through to a malformed context #343

Description

@clarkbw

Follow-up from #336 (review thread r3445099496).

#336 added if (isEmpty(parts[1])) return null before the MMSI substring, which drops empty-MMSI frames ($CDDSC,12,,,07,,,,,,*57) and the bare-$CDDSC,12 TypeError. But a sparse frame with a non-empty but non-numeric MMSI still gets through:

$CDDSC,12,ABC,...

isEmpty is false, so parts[1]!.substring(0, 9) runs on ABC and produces a malformed vessels.urn:mrn:imo:mmsi:ABC context.

Fix is to tighten the parts[1] guard from empty-check to a numeric check (MMSI is always digits per ITU-R M.493). Left out of #336 to keep that PR scoped to distress-alert recognition.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions