Skip to content

Fixed return type of GetPayloadLength - #235

Merged
nayakned merged 1 commit into
COVESA:mainfrom
GragonGit:234-Fix-return-type-of-GetPayloadLength
Nov 10, 2026
Merged

nayakned merged 1 commit into
COVESA:mainfrom
GragonGit:234-Fix-return-type-of-GetPayloadLength

Conversation

@GragonGit

Copy link
Copy Markdown
Contributor

Fixed return type of Avtp_<type>_GetPayloadLength to be uint16_t for data formats whose payload length may succeed 255 bytes. Namely:

  • ABB
  • CANXL
  • CANXL-Brief
  • GBB
  • MOST

Also added related tests regarding large payloads for these types.

Fixes #234

@GragonGit
GragonGit force-pushed the 234-Fix-return-type-of-GetPayloadLength branch from d985dd7 to a96e371 Compare November 5, 2026 13:04
Signed-off-by: Tristan Nußbaum <tnussbaum@stud.hs-heilbronn.de>
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.56%. Comparing base (de3d688) to head (ad8e445).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #235      +/-   ##
==========================================
+ Coverage   99.55%   99.56%   +0.01%     
==========================================
  Files          61       61              
  Lines        9342     9489     +147     
  Branches      329      334       +5     
==========================================
+ Hits         9300     9448     +148     
+ Misses         41       40       -1     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the payload-length getter changes.

No open issues 🎉

What changed in this PR

Fixes #234 by widening payload-length getters for five Open1722 ACF formats, preventing truncation of lengths above 255 bytes.

Changes:

  • Changes getter return types and result casts from uint8_t to uint16_t for ABB, CANXL, CANXL-Brief, GBB, and MOST.
  • Adds regression tests for large payloads, the 255/256-byte boundary, and maximum ACF message lengths.
  • Adds large-message creation tests covering payload contents, padding, and validity.
File Description
unit/​test-most.c Adds MOST length and large-message regression tests.
unit/​test-gbb.c Adds GBB length and large-message regression tests.
unit/​test-canxl.c Adds CANXL length and large-message regression tests.
unit/​test-canxl-brief.c Adds CANXL-Brief length and large-message regression tests.
unit/​test-abb.c Adds ABB length and large-message regression tests.
include/​avtp/​acf/​Most.h Widens the MOST payload-length getter to uint16_t.
include/​avtp/​acf/​Gbb.h Widens the GBB payload-length getter to uint16_t.
include/​avtp/​acf/​CanXlBrief.h Widens the CANXL-Brief payload-length getter to uint16_t.
include/​avtp/​acf/​CanXl.h Widens the CANXL payload-length getter to uint16_t.
include/​avtp/​acf/​Abb.h Widens the ABB payload-length getter to uint16_t.

Review effort: Balanced

@nayakned nayakned left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Thank you for the fix and the new tests.

@nayakned
nayakned merged commit 906a0de into COVESA:main Nov 10, 2026
9 checks passed
@GragonGit
GragonGit deleted the 234-Fix-return-type-of-GetPayloadLength branch November 10, 2026 13:29
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.

Return type of Avtp_<type>_GetPayloadLength

3 participants