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

Open
#450 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
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
networking

Research direction

Start with the sanitizer reports at lines 133 and 426 of fsw/src/cf_cfdp_r.c, then read the related CF_CFDP_R2_Complete and CF_CFDP_R2_SubstateRecvFileData cases in cf_cfdp_r_tests.c. Reproduce with the listed sanitizer compile options and native unit-test commands. Done means the affected tests still pass without null-pointer 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.
  • performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
The following run time error are reported when running with f-sanitizer options:

[BEGIN] 10 CF_CFDP_R2_Complete
[ PASS] 10.001 cf_cfdp_r_tests.c:494 - CF_CFDP_R2_Complete(txn, 0)
[ PASS] 10.002 cf_cfdp_r_tests.c:495 - txn->state_data.receive.sub_state (0) == CF_RxSubState_FILEDATA (0)
[ PASS] 10.003 cf_cfdp_r_tests.c:500 - CF_CFDP_R2_Complete(txn, 0)
[ PASS] 10.004 cf_cfdp_r_tests.c:505 - CF_CFDP_R2_Complete(txn, 1)
[ PASS] 10.005 cf_cfdp_r_tests.c:506 - txn->flags.rx.send_nak (1) == true (1)
[ PASS] 10.006 cf_cfdp_r_tests.c:507 - txn->state_data.receive.sub_state (0) == CF_RxSubState_FILEDATA (0)
[ PASS] 10.007 cf_cfdp_r_tests.c:508 - txn->state_data.receive.r2.acknak_count (1) == 1 (1)
[ PASS] 10.008 cf_cfdp_r_tests.c:511 - CF_CFDP_R2_Complete(txn, 1)
[ PASS] 10.009 cf_cfdp_r_tests.c:512 - txn->flags.rx.send_fin (1) == true (1)
[ PASS] 10.010 cf_cfdp_r_tests.c:513 - txn->flags.rx.complete (1) == true (1)
[ PASS] 10.011 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_R_NAK_LIMIT (72)
[ PASS] 10.012 cf_cfdp_r_tests.c:515 - CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.fault.nak_limit (1) == 1 (1)
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp_r.c:133:44: runtime error: member access within null pointer of type 'struct CF_ChunkWrapper_t'
[ PASS] 10.013 cf_cfdp_r_tests.c:521 - CF_CFDP_R2_Complete(txn, 0)
[ PASS] 10.014 cf_cfdp_r_tests.c:522 - txn->state_data.receive.sub_state (0) == CF_RxSubState_FILEDATA (0)
[ PASS] 10.015 cf_cfdp_r_tests.c:526 - CF_CFDP_R2_Complete(txn, 1)
[ PASS] 10.016 cf_cfdp_r_tests.c:527 - txn->flags.rx.send_nak (0) == false (0)
[ PASS] 10.017 cf_cfdp_r_tests.c:528 - txn->flags.rx.send_fin (1) == true (1)
[ PASS] 10.018 cf_cfdp_r_tests.c:529 - txn->flags.rx.complete (1) == true (1)
[ PASS] 10.019 cf_cfdp_r_tests.c:533 - CF_CFDP_R2_Complete(txn, 1)
[ PASS] 10.020 cf_cfdp_r_tests.c:534 - txn->flags.rx.send_nak (1) == true (1)
[ PASS] 10.021 cf_cfdp_r_tests.c:535 - txn->state_data.receive.sub_state (0) == CF_RxSubState_FILEDATA (0)
[ PASS] 10.022 cf_cfdp_r_tests.c:536 - txn->state_data.receive.r2.acknak_count (1) == 1 (1)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 10 CF_CFDP_R2_Complete  TOTAL::22    PASS::22    FAIL::0     MIR::0     TSF::0     TTF::0  
[BEGIN] 16 CF_CFDP_R2_SubstateRecvFileData
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp_r.c:426:9: runtime error: member access within null pointer of type 'struct CF_ChunkWrapper_t'
[ PASS] 16.001 cf_cfdp_r_tests.c:769 - CF_CFDP_R2_SubstateRecvFileData(txn, ph)
[ PASS] 16.002 cf_cfdp_r_tests.c:770 - CallCount: CF_ChunkListAdd() (1) == 1 (1)
[ PASS] 16.003 cf_cfdp_r_tests.c:771 - txn->state_data.receive.r2.acknak_count (0) == ZERO (0)
[ PASS] 16.004 cf_cfdp_r_tests.c:772 - CallCount: CF_CFDP_ArmAckTimer() (1) == 1 (1)
[ PASS] 16.005 cf_cfdp_r_tests.c:778 - CF_CFDP_R2_SubstateRecvFileData(txn, ph)
[ PASS] 16.006 cf_cfdp_r_tests.c:779 - CallCount: CF_CFDP_ArmAckTimer() (2) == 2 (2)
[ PASS] 16.007 cf_cfdp_r_tests.c:780 - txn->state_data.receive.r2.acknak_count (0) == ZERO (0)
[ PASS] 16.008 cf_cfdp_r_tests.c:786 - CF_CFDP_R2_SubstateRecvFileData(txn, ph)
[ PASS] 16.009 cf_cfdp_r_tests.c:787 - CallCount: CF_CFDP_ArmAckTimer() (2) == 2 (2)
[ PASS] 16.010 cf_cfdp_r_tests.c:788 - txn->state_data.receive.r2.acknak_count (0) == ZERO (0)
[ PASS] 16.011 cf_cfdp_r_tests.c:793 - CF_CFDP_R2_SubstateRecvFileData(txn, ph)
[ PASS] 16.012 cf_cfdp_r_tests.c:794 - txn->flags.rx.send_fin (1) == true (1)
[ PASS] 16.013 cf_cfdp_r_tests.c:800 - CF_CFDP_R2_SubstateRecvFileData(txn, ph)
[ PASS] 16.014 cf_cfdp_r_tests.c:801 - CallCount: CF_CFDP_ResetTransaction() (1) == 1 (1)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 16 CF_CFDP_R2_SubstateRecvFileData TOTAL::14    PASS::14    FAIL::0     MIR::0     TSF::0     TTF::0   

To Reproduce
Steps to reproduce the behavior:

  1. 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
    )

  2. Make SIMULATION=native ENABLE_UNIT_TESTS=true prep

  3. make install

  4. Run Test

Expected behavior
N/A

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.