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

Open
#453 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
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c
Domain
embedded-iot

Research direction

Start with the sanitizer output in fsw/src/cf_cfdp.c at lines 1683 and 1757, then inspect the related cases in cf_cfdp_tests.c, including CF_CFDP_ResetTransaction and CF_CFDP_RecvIdle. Reproduce the native unit-test run with the listed sanitizer options. Done means the reported runtime errors no longer occur while the existing tests continue to pass.

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
Running with f-sanititzer report run time error:

[BEGIN] 22 CF_CFDP_RecvIdle
[ PASS] 22.001 cf_cfdp_tests.c:489 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.002 cf_cfdp_tests.c:490 - txn->state (5) == CF_TxnState_DROP (5)
[ PASS] 22.003 cf_cfdp_tests.c:496 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.004 cf_cfdp_tests.c:497 - txn->state (3) == CF_TxnState_R2 (3)
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp.c:1757:9: runtime error: null pointer passed as argument 2, which is declared to never be null
[ PASS] 22.005 cf_cfdp_tests.c:503 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.006 cf_cfdp_tests.c:504 - txn->state (1) == CF_TxnState_R1 (1)
[ PASS] 22.007 cf_cfdp_tests.c:509 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.008 cf_cfdp_tests.c:510 - txn->state (3) == CF_TxnState_R2 (3)
[ PASS] 22.009 cf_cfdp_tests.c:518 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.010 cf_cfdp_tests.c:519 - txn->state (0) == CF_TxnState_IDLE (0)
[ PASS] 22.011 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_IDLE_MD (62)
[ PASS] 22.012 cf_cfdp_tests.c:524 - CF_CFDP_RecvIdle(txn, ph)
[ PASS] 22.013 cf_cfdp_tests.c:525 - txn->state (0) == CF_TxnState_IDLE (0)
[ PASS] 22.014 cf_test_utils.c:94 - Generated event: CF_EID_ERR_CFDP_FD_UNHANDLED (63)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 22 CF_CFDP_RecvIdle     TOTAL::14    PASS::14    FAIL::0     MIR::0     TSF::0     TTF::0  
[BEGIN] 09 CF_CFDP_ResetTransaction
[ PASS] 09.001 cf_cfdp_tests.c:1367 - CF_CFDP_ResetTransaction(txn, 0)
/home/vboxuser/Desktop/cFS/apps/cf/fsw/src/cf_cfdp.c:1683:5: runtime error: member access within null pointer of type 'struct CF_ChunkWrapper_t'
[ PASS] 09.002 cf_cfdp_tests.c:1372 - CF_CFDP_ResetTransaction(txn, 1)
[ PASS] 09.003 cf_cfdp_tests.c:1373 - CallCount: CF_FreeTransaction() (1) == 1 (1)
[ PASS] 09.004 cf_cfdp_tests.c:1380 - CF_CFDP_ResetTransaction(txn, 1)
[ PASS] 09.005 cf_cfdp_tests.c:1381 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.006 cf_cfdp_tests.c:1382 - CallCount: CF_FreeTransaction() (2) == 2 (2)
[ PASS] 09.007 cf_cfdp_tests.c:1389 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.008 cf_cfdp_tests.c:1390 - CallCount: OS_mv() (0) == 0 (0)
[ PASS] 09.009 cf_cfdp_tests.c:1391 - CallCount: OS_remove() (1) == 1 (1)
[ PASS] 09.010 cf_cfdp_tests.c:1396 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.011 cf_cfdp_tests.c:1397 - CallCount: OS_mv() (1) == 1 (1)
[ PASS] 09.012 cf_cfdp_tests.c:1398 - CallCount: OS_remove() (0) == 0 (0)
[ PASS] 09.013 cf_cfdp_tests.c:1404 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.014 cf_cfdp_tests.c:1405 - CallCount: OS_mv() (1) == 1 (1)
[ PASS] 09.015 cf_cfdp_tests.c:1406 - CallCount: OS_remove() (1) == 1 (1)
[ PASS] 09.016 cf_cfdp_tests.c:1413 - CF_CFDP_ResetTransaction(txn, 1)
[ PASS] 09.017 cf_cfdp_tests.c:1414 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.018 cf_cfdp_tests.c:1415 - CallCount: CF_FreeTransaction() (2) == 2 (2)
[ PASS] 09.019 cf_cfdp_tests.c:1423 - CF_CFDP_ResetTransaction(txn, 1)
[ PASS] 09.020 cf_cfdp_tests.c:1424 - CF_CFDP_ResetTransaction(txn, 0)
[ PASS] 09.021 cf_cfdp_tests.c:1425 - CallCount: CF_FreeTransaction() (2) == 2 (2)
[ PASS] 09.022 cf_cfdp_tests.c:1441 - CF_CFDP_ResetTransaction(txn, 1)
[ PASS] 09.023 cf_cfdp_tests.c:1442 - chan->cur (0x0) == NULL (0x0)
[ PASS] 09.024 cf_cfdp_tests.c:1443 - pb.num_ts (9) == 9 (9)
[ PASS] 09.025 cf_cfdp_tests.c:1444 - chan->num_cmd_tx (7) == 7 (7)
[ PASS] 09.026 cf_cfdp_tests.c:1445 - CallCount: CF_FreeTransaction() (1) == 1 (1)
[ INFO]                        ABORT::0     WARN::0     FLOW::0     DEBUG::0     N/A::0   
[  END] 09 CF_CFDP_ResetTransaction TOTAL::26    PASS::26    FAIL::0     MIR::0     TSF::0     TTF::0  

To Reproduce
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.