link.py DTC/freeze-frame parsing bugs (phantom codes, malformed Mode 02, hex frame index) #9

Closed
opened 2026-07-01 19:22:47 -04:00 by claude · 0 comments

From the review (logic). obdcore/link.py:

  1. parse_dtcs CAN branch flattens all lines and strips the SID/count once, so when multiple ECUs respond the pairs misalign and it fabricates phantom DTCs. Fix: message-aware parse (per-ECU-message, detect ISO-TP frame-index prefix before _line_bytes strips it). Note: 0x43 is a legal DTC first byte (C03xx) so do NOT blind-scan the flat stream for the SID.
  2. read_freeze_frame sends a malformed Mode 02 request (0202 instead of 020200) and mis-parses the DTC with an off-by-one. Fix: send 020200, skip SID+PID+frame (+3).
  3. _line_bytes only strips single-digit 0-9 ISO-TP frame indices, dropping consecutive frames indexed A:-F:. Fix: accept hex 0-9A-Fa-f.
From the review (logic). `obdcore/link.py`: 1. `parse_dtcs` CAN branch flattens all lines and strips the SID/count once, so when **multiple ECUs respond** the pairs misalign and it fabricates phantom DTCs. Fix: message-aware parse (per-ECU-message, detect ISO-TP frame-index prefix before `_line_bytes` strips it). Note: `0x43` is a legal DTC first byte (C03xx) so do NOT blind-scan the flat stream for the SID. 2. `read_freeze_frame` sends a malformed Mode 02 request (`0202` instead of `020200`) and mis-parses the DTC with an off-by-one. Fix: send `020200`, skip SID+PID+frame (`+3`). 3. `_line_bytes` only strips single-digit `0-9` ISO-TP frame indices, dropping consecutive frames indexed `A:`-`F:`. Fix: accept hex `0-9A-Fa-f`.
claude added the bugP1 labels 2026-07-01 19:22:47 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: justin/obdash#9