Skip to content

Commit 7a108e8

Browse files
authored
CBMC proof harness type fixes (#510)
These changes add necessary forward declarations (or system headers includes) and address inconsistencies in how we invoke functions from CBMC proof harnesses as compared to their original signatures.
1 parent 2557f84 commit 7a108e8

File tree

25 files changed

+59
-18
lines changed

25 files changed

+59
-18
lines changed

test/cbmc/proofs/Malloc_FreeRTOS/Malloc_FreeRTOS_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
/* FreeRTOS includes for OTA library. */
3030
#include "ota_os_freertos.h"
3131

32+
#include <stdlib.h>
33+
3234
void * pvPortMalloc( size_t size )
3335
{
3436
return malloc( size );

test/cbmc/proofs/OTA_CBOR_Decode_GetStreamResponseMessage/OTA_CBOR_Decode_GetStreamResponseMessage_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "cbor.h"
3131
#include "ota_cbor_private.h"
3232

33+
#include <stdlib.h>
34+
3335
/* Stub to return CBORerror type. */
3436
CborError returnCborError()
3537
{

test/cbmc/proofs/OTA_GetStatistics/OTA_GetStatistics_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
/* Ota Agent includes. */
3030
#include "ota.h"
3131

32+
#include <stdlib.h>
33+
3234
void OTA_GetStatistics_harness()
3335
{
3436
OtaErr_t err;

test/cbmc/proofs/OtaReceiveEvent_FreeRTOS/OtaReceiveEvent_FreeRTOS_harness.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
#include "ota_private.h"
3232
#include "FreeRTOSConfig.h"
3333

34+
#include <stdlib.h>
35+
3436
void OtaReceiveEvent_FreeRTOS_harness()
3537
{
3638
OtaEventContext_t * pEventCtx;
3739
OtaOsStatus_t osStatus;
38-
void * pEventMsg;
3940
uint32_t timeout;
4041

4142
void * pEventMsg = ( void * ) malloc( sizeof( OtaEventMsg_t ) );

test/cbmc/proofs/OtaStartTimer_FreeRTOS/OtaStartTimer_FreeRTOS_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include "ota_os_freertos.h"
3131
#include "FreeRTOSConfig.h"
3232

33+
#include <stdlib.h>
34+
3335
void otaCallback( OtaTimerId_t otaTimerId )
3436
{
3537
__CPROVER_assert( otaTimerId == OtaRequestTimer || otaTimerId == OtaSelfTestTimer,

test/cbmc/proofs/Posix_OtaReceiveEvent/Posix_OtaReceiveEvent_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include <poll.h>
3636
#include <mqueue.h>
3737

38+
int nondet_int();
39+
3840
/* Counter for the number of iterations. */
3941
static int count = 0;
4042

test/cbmc/proofs/Posix_OtaSendEvent/Posix_OtaSendEvent_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
/* Counter for the number of iterations. */
3535
static int count = 0;
3636

37+
int nondet_int();
38+
3739
int poll( struct pollfd * fds,
3840
nfds_t nfds,
3941
int timeout )

test/cbmc/proofs/closeFileHandler/closeFileHandler_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
/* Ota Agent includes. */
3030
#include "ota.h"
3131

32+
#include <stdlib.h>
33+
3234
OtaErr_t __CPROVER_file_local_ota_c_closeFileHandler( const OtaEventData_t * pEventData );
3335

3436
void closeFileHandler_harness()

test/cbmc/proofs/decodeBase64IndexBuffer/decodeBase64IndexBuffer_harness.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
#define MAX_NUM_BASE64_DATA 4U
4040

4141
/* Declaration of the mangled name static function which is created by CBMC for static functions. */
42-
Base64Status_t __CPROVER_file_local_ota_base64_c_decodeBase64IndexBuffer( uint8_t * pDest,
43-
const size_t destLen,
44-
size_t * pResultLen,
42+
Base64Status_t __CPROVER_file_local_ota_base64_c_decodeBase64IndexBuffer( uint32_t * pDest,
43+
uint32_t * destLen,
4544
const uint8_t * pEncodedData,
46-
const size_t encodedLen );
45+
const size_t encodedLen,
46+
size_t * pResultLen );
4747

4848
void decodeBase64IndexBuffer_harness()
4949
{

test/cbmc/proofs/executeHandler/executeHandler_harness.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
/* Ota Agent includes. */
3030
#include "ota.h"
3131

32+
#include <stdlib.h>
33+
3234
void __CPROVER_file_local_ota_c_executeHandler( uint32_t index,
3335
const OtaEventMsg_t * const pEventMsg );
3436

0 commit comments

Comments
 (0)