Repository navigation
fix(security): resolve CodeQL alerts in own sources; exclude vendored stb - #22
Merged
Merged
Conversation
… stb - clitools/main.cc: replace system() with shell-free spawn (fork+execvp on POSIX, _spawnvp on Windows) — fixes Critical 'Uncontrolled data used in OS command' (#39) - clitools/main.cc: size_t-cast malloc size computation for the resize buffer — fixes int-overflow alert (#38) - source/units/model_clip.cc: size_t-cast hidden-state element count — fixes int-overflow alert (#17) - codeql-config.yml: paths-ignore clitools/stb (vendored nothings/stb headers — third-party code, report findings upstream)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
CodeQL Advanced 跑通后首轮扫描发现 23 个告警:3 个在自有代码,20 个在 vendored 的 stb 头文件。
改动
system()改为无 shell spawn(POSIX
fork+execvp,Windows_spawnvp),消除命令注入面malloc(size_t(h) * size_t(w) * 3)消除 int 溢出paths-ignore增加clitools/stb(vendored nothings/stb 第三方头文件,不在本仓库维护,问题应报上游)
验证
gcc-14 -fsyntax-only -std=c++17通过(POSIX 路径)_spawnvp(_P_WAIT, ...)标准用法,由 CI 的 windows 构建覆盖