Summary
Label_QP, Label_QR, and Label_QS blindly slice message.text at fixed offsets with no length check. Two failure modes fall out of the same missing guard:
- Silent-wrong-output: any text under 12 chars is fed straight to
text.substring(0,4) / text.substring(4,8) / text.substring(8,12), so the plugin returns decoded: true with empty or truncated ICAO airport codes.
- Crash: if chars 8-11 aren't numeric,
convertHHMMSSToTod returns NaN, which reaches ResultFormatter.out → DateTimeUtils.timestampToString(NaN) → RangeError: Invalid time value, aborting the entire MessageDecoder.decode() call.
Location
lib/plugins/Label_QP.ts:20-33
lib/plugins/Label_QR.ts:20-33
lib/plugins/Label_QS.ts:20-33
(Identical shape — same substring math with no length check.) Excerpt:
ResultFormatter.departureAirport(decodeResult, message.text.substring(0, 4));
ResultFormatter.arrivalAirport(decodeResult, message.text.substring(4, 8));
ResultFormatter.out(
decodeResult,
DateTimeUtils.convertHHMMSSToTod(message.text.substring(8, 12)),
);
Reproduction
Silent empty ICAO:
new MessageDecoder().decode({ label: 'QP', text: 'AA' });
// -> decoded: true, raw.departure_icao === 'AA', raw.arrival_icao === ''
Crash (garbage time field):
new MessageDecoder().decode({ label: 'QP', text: 'KSDLKLASABCD' });
// -> convertHHMMSSToTod('ABCD') -> NaN
// -> ResultFormatter.out -> timestampToString(NaN) -> RangeError
// -> escapes MessageDecoder.decode()
Impact
The empty-ICAO half is a silent-wrong-output pattern analogous to the empty-lat/lon (0,0) family (#487/#495/#497) but for airport codes; the crash half is a variant of the timestamp-family crash (filed alongside as a separate ResultFormatter issue). Both are reachable from a single unauthenticated ACARS input.
Suggested fix
Require the text to be at least 12 chars and the time field to be numeric before decoding; otherwise emit decodeLevel: 'none' / decoded: false. Applies identically to Label_QP, Label_QR, and Label_QS (and worth auditing Label_QQ variant-3 for the same pattern).
Summary
Label_QP,Label_QR, andLabel_QSblindly slicemessage.textat fixed offsets with no length check. Two failure modes fall out of the same missing guard:text.substring(0,4)/text.substring(4,8)/text.substring(8,12), so the plugin returnsdecoded: truewith empty or truncated ICAO airport codes.convertHHMMSSToTodreturnsNaN, which reachesResultFormatter.out→DateTimeUtils.timestampToString(NaN)→RangeError: Invalid time value, aborting the entireMessageDecoder.decode()call.Location
lib/plugins/Label_QP.ts:20-33lib/plugins/Label_QR.ts:20-33lib/plugins/Label_QS.ts:20-33(Identical shape — same substring math with no length check.) Excerpt:
Reproduction
Silent empty ICAO:
Crash (garbage time field):
Impact
The empty-ICAO half is a silent-wrong-output pattern analogous to the empty-lat/lon
(0,0)family (#487/#495/#497) but for airport codes; the crash half is a variant of the timestamp-family crash (filed alongside as a separate ResultFormatter issue). Both are reachable from a single unauthenticated ACARS input.Suggested fix
Require the text to be at least 12 chars and the time field to be numeric before decoding; otherwise emit
decodeLevel: 'none'/decoded: false. Applies identically toLabel_QP,Label_QR, andLabel_QS(and worth auditingLabel_QQvariant-3 for the same pattern).