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

LGTM issue - integer comparison size mismatch #831

Closed
skliper opened this issue Aug 21, 2020 · 1 comment · Fixed by #832 or #849
Closed

LGTM issue - integer comparison size mismatch #831

skliper opened this issue Aug 21, 2020 · 1 comment · Fixed by #832 or #849
Assignees
Milestone

Comments

@skliper
Copy link
Contributor

skliper commented Aug 21, 2020

Is your feature request related to a problem? Please describe.

/* send an event for each pipe write error that may have occurred */
--
1489 | for(i=0;i < SBSndErr.EvtsToSnd; i++)
  | Comparison between i of type uint16 and EvtsToSnd of wider type uint32.
1490 | {
1491 | if(SBSndErr.EvtBuf[i].EventId == CFE_SB_MSGID_LIM_ERR_EID)

In theory if EvtsToSend is > max uint16 this could infinite loop. Pretty unlikely, but definitely shouldn't be in flight code.

Describe the solution you'd like
i should be sized appropriately

Describe alternatives you've considered
None

Additional context
Split off from #431

Requester Info
Jacob Hageman - NASA/GSFC

@skliper
Copy link
Contributor Author

skliper commented Aug 21, 2020

Moved back to enhancement, value is only incremented up to the number of possible destinations which wouldn't be > uint16 so not a real bug. Still good to squash the warning.

EDIT - max destinations is currently set to 16, but it's configurable...

yammajamma added a commit that referenced this issue Aug 26, 2020
Fix #831, Resolve int size mismatch in loop comparison
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant