f-sanitizer report run time error in coverage-cf-cf_cfdp_s-testrunner

Open
#452 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c

Research direction

Reproduce the sanitizer-enabled native unit-test build and inspect the reports at cf_cfdp_s.c:275 and cf_cdp_s.c:515, along with the CF_CFDP_S_Tick_Nak and CF_CFDP_S2_Nak cases in cf_cfdp_s_tests.c. Trace the null CF_ChunkWrapper_t accesses and update the relevant behavior so the tests still pass without sanitizer runtime errors.

Written by the indexing model from the issue text.

Description

bug unit-test

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
f-sanitizer report runtime error::

[BEGIN] 19 CF_CFDP_S2_Nak
[ PASS] 19.001 cf_cfdp_s_tests.c:744 - CF_CFDP_S2_Nak(txn, ph)
[ PASS] 19.002 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_S_PDU_NAK (101)
[ PASS] 19.003 cf_cfdp_s_tests.c:746 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.error (1) == 1 (1)
[ PASS] 19.004 cf_cfdp_s_tests.c:753 - CF_CFDP_S2_Nak(txn, ph)
[ PASS] 19.005 cf_cfdp_s_tests.c:754 - txn->flags.tx.md_need_send (1) == true (1)
[ PASS] 19.006 cf_cfdp_s_tests.c:755 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.nak_segment_requests (1) == 1 (1)
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp_s.c:515:17: runtime error: member access within null pointer of type 'struct CF_ChunkWrapper_t'
[ PASS] 19.007 cf_cfdp_s_tests.c:764 - CF_CFDP_S2_Nak(txn, ph)
[ PASS] 19.008 cf_cfdp_s_tests.c:765 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.nak_segment_requests (3) == 3 (3)
[ PASS] 19.009 cf_cfdp_s_tests.c:775 - CF_CFDP_S2_Nak(txn, ph)
[ PASS] 19.010 cf_cfdp_s_tests.c:776 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.nak_segment_requests (6) == 6 (6)
[ PASS] 19.011 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_S_INVALID_SR (100)
[ PASS] 19.012 cf_cfdp_s_tests.c:784 - CF_CFDP_S2_Nak(txn, ph)
[ PASS] 19.013 cf_cfdp_s_tests.c:785 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.error (2) == 2 (2)
[ PASS] 19.014 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_S_PDU_NAK (101)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 19 CF_CFDP_S2_Nak       TOTAL::14    PASS::14    FAIL::0     MIR::0     TSF::0     TTF::0  
[BEGIN] 06 CF_CFDP_S_Tick_Nak
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp_s.c:275:44: runtime error: member access within null pointer of type 'struct CF_ChunkWrapper_t'
[ PASS] 06.001 cf_cfdp_s_tests.c:319 - CF_CFDP_S_Tick_Nak(txn, &cont)
[ PASS] 06.002 cf_cfdp_s_tests.c:320 - cont (0) == ZERO (0)
[ PASS] 06.003 cf_cfdp_s_tests.c:325 - CF_CFDP_S_Tick_Nak(txn, &cont)
[ PASS] 06.004 cf_cfdp_s_tests.c:326 - cont (1) != ZERO (0)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 06 CF_CFDP_S_Tick_Nak   TOTAL::4     PASS::4     FAIL::0     MIR::0     TSF::0     TTF::0  

To Reproduce
Steps to reproduce the behavior:
Add the following option:
add_compile_options(
-fsanitize=address
-fsanitize=undefined
-fsanitize-recover=all
-g
)
add_link_options(
-fsanitize=address
-fsanitize=undefined
-fsanitize-recover=all
)

Make SIMULATION=native ENABLE_UNIT_TESTS=true prep

make install

Run Test

Expected behavior
A clear and concise description of what you expected to happen.

Code snips
If applicable, add references to the software.

System observed on:

  • Hardware
  • OS: [e.g. Linux 4.4]
  • Versions [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps]

Additional context
Add any other context about the problem here.

Reporter Info
Full name and company/organization if applicable

Anh Van, GSFC

Dominant language
C
Stars
123
Forks
82
Avg merge
2d 22h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nasa/CF

All issues in nasa/CF

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.