-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Copy link
Labels
CoverityA Coverity detected issue or its fixA Coverity detected issue or its fixbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Milestone
Description
Static code scan issues found in file:
Category: Memory - corruptions
Function: test_memstr
Component: Tests
CID: 220426
Details:
zephyr/tests/lib/c_lib/src/main.c
Line 536 in 169144a
| memcpy(&arr[i], num, 0); |
530 zassert_is_null(memchr(str, 'a', 0), "memchr 0 error");
531 zassert_not_null(memchr(str, 'e', 10), "memchr serach e");
532 zassert_is_null(memchr(str, 'e', 1), "memchr e error");
533
534 for (i = 0; i < 20; i++) {
535 for (j = 0; j < 20; j++) {
>>> CID 220426: Memory - corruptions (OVERRUN)
>>> Calling "memcpy" with "&arr[i]" and "0U" is suspicious because the function call may access "arr" at byte "i + 18446744073709551615U". [Note: The source code implementation of the function has been overridden by a builtin model.]
536 memcpy(&arr[i], num, 0);
537 ret = memcmp(&num[j], &arr[i], 0);
538 zassert_true((ret == 0), "memcpy failed");
539 memcpy(&arr[i], &num[j], 1);
540 ret = memcmp(&num[j], &arr[i], 1);
541 zassert_true((ret == 0), "memcpy failed");
Please fix or provide comments in coverity using the link:
https://scan9.coverity.com/reports.htm#v29271/p12996
Note: This issue was created automatically. Priority was set based on classification
of the file affected and the impact field in coverity. Assignees were set using the CODEOWNERS file.
Metadata
Metadata
Assignees
Labels
CoverityA Coverity detected issue or its fixA Coverity detected issue or its fixbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug