Open celskeggs opened 4 days ago
Agreed. This should be fixed.
@timcanham functionally this is an index into the port array and is unsigned. Is there a reason to keep this type signed, other than the historical usage of NATIVE_INT_TYPE
before the use of FwIndexType
?
No reason... We can change it, but it would be a breaking fix for existing users' implementation classes.
Problem Description
Autocoded base class functions contain a FW_ASSERT to check that the specified port number is in range. The index type is signed, but the comparison only checks for a maximum. This means that a negative number would not be caught.
Example:
Context / Environment
Execute
fprime-util version-check
and share the output.How to Reproduce
Expected Behavior
FW_ASSERT
should be used to check for negativeportNum
values and not just positiveportNum
values.