Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2582, Cast to unsigned int #2585

Merged
merged 2 commits into from
Aug 2, 2024
Merged

Conversation

tandharia
Copy link

Checklist (Please check before submitting)

Describe the contribution

Fixes #2582

  • cfe_msg_sechdr_time.c promotes the byte (unsigned char) to a signed integer before the shift operation, which can cause overflow on a 32-bit machine.
  • Modified the code to cast the bytes to unsigned integers before performing the shift operations to avoid overflow issues.

Testing performed

Unit Testing

Expected behavior changes

Reduced risk of overflow-related bugs.

System(s) tested on

OS: Ubuntu 18.04

Contributor Info - All information REQUIRED for consideration of pull request

Tvisha Andharia - GSFC 582 intern

@dzbaker
Copy link
Collaborator

dzbaker commented Aug 1, 2024

CCB 1 Aug 2024: Approved pending workflow runs and replacing "unsigned int" with "uint32".

Copy link
Contributor

@jphickey jphickey left a comment

Choose a reason for hiding this comment

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

Suggest using uint32 instead of unsigned int here, as int can be 16 bits.

@dzbaker dzbaker added CCB:Approved Indicates code review and approval by community CCB and removed CCB:Provisionally-Approved labels Aug 1, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Aug 2, 2024
*Combines:*

cFE equuleus-rc1+dev183

**Includes:**

*cFE*
- nasa/cFE#2579
- nasa/cFE#2565
- nasa/cFE#2584
- nasa/cFE#2585
- nasa/cFE#2586
- nasa/cFE#2326

Co-authored by: Tvisha Andharia <[email protected]>
Co-authored by: Anh Van <[email protected]>
Co-authored by: Joseph Hickey <[email protected]>
Co-authored by: Avi Weiss <[email protected]>
@dzbaker dzbaker merged commit 481109e into nasa:main Aug 2, 2024
20 of 21 checks passed
dzbaker added a commit to nasa/cFS that referenced this pull request Aug 2, 2024
*Combines:*

cFE equuleus-rc1+dev183

**Includes:**

*cFE*
- nasa/cFE#2579
- nasa/cFE#2565
- nasa/cFE#2584
- nasa/cFE#2585
- nasa/cFE#2586
- nasa/cFE#2326

Co-authored by: Tvisha Andharia <[email protected]>
Co-authored by: Anh Van <[email protected]>
Co-authored by: Joseph Hickey <[email protected]>
Co-authored by: Avi Weiss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code review and approval by community CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible Signed Integer Overflow in CFE_MSG_GetMsgTime
3 participants