Skip to content

Commit

Permalink
Keep assumptions in validity functions
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe R. Monteiro <[email protected]>
  • Loading branch information
feliperodri authored and markrtuttle committed Oct 27, 2021
1 parent 495b7d7 commit 702c4bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ void harness()

pIncomingPacket = allocateMqttPacketInfo( NULL );
__CPROVER_assume( isValidMqttPacketInfo( pIncomingPacket ) );
__CPROVER_assume( IMPLIES( pIncomingPacket != NULL, pIncomingPacket->remainingLength < REMAINING_LENGTH_MAX ) );

/* These are allocated for coverage of a NULL input. */
pPacketId = malloc( sizeof( uint16_t ) );
Expand Down
5 changes: 5 additions & 0 deletions test/cbmc/sources/mqtt_cbmc_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ bool isValidMqttPacketInfo( const MQTTPacketInfo_t * pPacketInfo )
{
bool isValid = true;

if( pPacketInfo != NULL )
{
isValid = isValid && pPacketInfo->remainingLength < REMAINING_LENGTH_MAX;
}

return isValid;
}

Expand Down

0 comments on commit 702c4bb

Please sign in to comment.