Valgrind reports source and destination overlap in memcpy_chk in cpuinfo_linux_parse_cpulist
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.2k
- Forks
- 409
- PR merge metrics
- No merged PRs in 30d
Description
When running a program that depends on ONNX Runtime (which includes cpuinfo) under Valgrind, I encounter the following error originating from cpulist.c:
==3397093== Source and destination overlap in memcpy_chk(0x1ffefff8b0, 0x1ffefff8b0, 5)
==3397093== at 0x48517A0: __memcpy_chk (vg_replace_strmem.c:1723)
==3397093== by 0x5BB2405: memmove (string_fortified.h:36)
==3397093== by 0x5BB2405: cpuinfo_linux_parse_cpulist (cpulist.c:227)
...
It appears that memmove is being called with the same source and destination pointers in cpuinfo_linux_parse_cpulist, which triggers this warning in Valgrind. Could you please take a look and suggest a fix? Thank you!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cpulist.c at line 227, where cpuinfo_linux_parse_cpulist triggers the reported memcpy_chk warning under Valgrind. Reproduce the parsing path with Valgrind and inspect the surrounding source and destination handling. Done means the overlap warning no longer occurs while cpulist parsing continues to work correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100