Validate DBC frame definitions and report parse errors with line numbers #3

Closed
opened 2026-10-01 17:15:32 +00:00 by deeaitch · 0 comments
Owner

Description:
DbcParser::ParseFrameLine() does not check whether required fields were successfully read. Malformed frame definitions can silently produce incorrect metadata.
Reproduction:
Input:
BO_ invalid
Expected: a parse error identifying the malformed frame definition and its line number.
Actual: parsing succeeds and creates a frame named BO_ with CAN ID 0 and payload length 0.
Scope:

  • Validate all required BO_ fields: CAN ID, frame name, colon delimiter, payload length, and transmitter.
  • Reject malformed numeric fields and values that would overflow or truncate during conversion.
  • Validate the normalized CAN ID against the 29-bit identifier range.
  • Include the file path and line number in parser error messages.
  • Add regression tests for valid standard/extended frames and malformed definitions.
  • Update README with the validation rules and error-reporting behavior.
  • Do not modify generated docs.
    Acceptance criteria:
  • The reproduction case fails with a descriptive error containing the file path and line number.
  • Missing fields, malformed numbers, invalid identifiers, and payload lengths exceeding the storage type are rejected.
  • Existing valid frame definitions continue to parse correctly.
  • Parser and decoder regression tests pass.
  • The project builds without warnings using -Wall -Wextra -Wpedantic -Werror
Description: DbcParser::ParseFrameLine() does not check whether required fields were successfully read. Malformed frame definitions can silently produce incorrect metadata. Reproduction: Input: BO_ invalid Expected: a parse error identifying the malformed frame definition and its line number. Actual: parsing succeeds and creates a frame named BO_ with CAN ID 0 and payload length 0. Scope: - Validate all required BO_ fields: CAN ID, frame name, colon delimiter, payload length, and transmitter. - Reject malformed numeric fields and values that would overflow or truncate during conversion. - Validate the normalized CAN ID against the 29-bit identifier range. - Include the file path and line number in parser error messages. - Add regression tests for valid standard/extended frames and malformed definitions. - Update README with the validation rules and error-reporting behavior. - Do not modify generated docs. Acceptance criteria: - The reproduction case fails with a descriptive error containing the file path and line number. - Missing fields, malformed numbers, invalid identifiers, and payload lengths exceeding the storage type are rejected. - Existing valid frame definitions continue to parse correctly. - Parser and decoder regression tests pass. - The project builds without warnings using -Wall -Wextra -Wpedantic -Werror
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: automotive/dbc#3