openframeworks / openframeworks/openFrameworks
ofUtils warnings - snprintf, requires a string literal
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
we can add fmt lib to the core to deal with format
/Volumes/tool/ofw/libs/openFrameworks/utils/ofUtils.h:600:45: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
size_t n = std::snprintf(buf, sizeof(buf), format, std::forward<Args>(args)...);
/Volumes/tool/ofw/libs/openFrameworks/utils/ofUtils.h:600:45: note: treat the string as an argument to avoid this
size_t n = std::snprintf(buf, sizeof(buf), format, std::forward<Args>(args)...);
/Volumes/tool/ofw/libs/openFrameworks/utils/ofUtils.h:612:55: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
std::snprintf(const_cast<char*>(s.data()), s.size(), format, std::forward<Args>(args)...);
^~~~~~
/Volumes/tool/ofw/libs/openFrameworks/utils/ofUtils.h:612:55: note: treat the string as an argument to avoid this
std::snprintf(const_cast<char*>(s.data()), s.size(), format, std::forward<Args>(args)...);
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 by reviewing libs/openFrameworks/utils/ofUtils.h around lines 600 and 612, where the reported std::snprintf warnings occur, and inspect the surrounding formatting entry points. Build the affected target to reproduce the warnings and evaluate the proposed fmt approach; done means the warnings are resolved without breaking formatting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100