Skip to content

ci: the scan leaves out stb_image's statics and Dear ImGui's backend sources - #1188

Closed
transfix wants to merge 1 commit into
masterfrom
ci/scan-third-party-sources
Closed

transfix wants to merge 1 commit into
masterfrom
ci/scan-third-party-sources

Conversation

@transfix

Copy link
Copy Markdown
Owner

The writable-data scan leaves out two more pieces of third-party code that are compiled into our targets. They are not libcvc's, and no change of ours can move them onto the app (Joe: "we can't do anything about third party libs").

  • stb_image / stb_image_write. Their implementation is compiled into src/cvc/image/stb_io.cpp: stbi__g_failure_reason, the PNG chunk buffer invalid_chunk, and the PNG writer's filter tables. THIRD_PARTY matches ^stbiw?__.
    • Note: invalid_chunk is a mutable static buffer that stb writes the unknown chunk's name into, so two threads decoding bad PNGs at once race on the error text. STBI_NO_FAILURE_STRINGS would remove it, at the cost of stb's error messages. Not changed here.
  • Dear ImGui's backend and misc sources. The stock imgui_impl_opengl3.cpp (its GL loader table imgl3wProcs, the loader handles, version) and imgui_freetype.cpp (its allocator and loader hooks) are compiled into cvcGL from the deps bundle. The new THIRD_PARTY_SOURCES matches their source path (/include/imgui*/backends|misc/), since every symbol of such an object is the library's.

The allowlist drops their 15 lines (cvc 4, cvcGL 11). The ratchet passes, since only lines are removed.

Tests (test_scan.py): both are left out, while our own code in stb_io.cpp and in cvcGL's ImGui files is still scanned. Locally: 16 pass (the end-to-end case skips without an ELF toolchain).

Independent of the no-singletons stack (#1155 onward): it touches only tools/singleton_scan, and the stack's PRs delete other allowlist lines.

…sources

Both are third-party code compiled into our targets, not libcvc's:
- stb_image / stb_image_write's implementation is compiled into
  image/stb_io.cpp (stbi__g_failure_reason, the PNG chunk buffer, the
  PNG writer's filter tables): THIRD_PARTY matches ^stbiw?__.
- Dear ImGui's stock imgui_impl_opengl3.cpp and imgui_freetype.cpp are
  compiled into cvcGL from the deps bundle (its GL loader table, loader
  handles, FreeType hooks): the new THIRD_PARTY_SOURCES matches their
  source path.

The allowlist drops their 15 lines (cvc 4, cvcGL 11). Our own code in
stb_io.cpp and in cvcGL's ImGui files is still scanned (tests).
@transfix

Copy link
Copy Markdown
Owner Author

Replaced by #1203, which lands the whole no-singletons stack as one PR. This branch's head is an ancestor of #1203's branch, so its commits are all there; the branch is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant