Skip to content

Fix multiple bugs: resource leaks, UB, logic errors, and CI fixes#252

Open
BluerCool wants to merge 4 commits into
Slackadays:mainfrom
BluerCool:bug-fixes
Open

Fix multiple bugs: resource leaks, UB, logic errors, and CI fixes#252
BluerCool wants to merge 4 commits into
Slackadays:mainfrom
BluerCool:bug-fixes

Conversation

@BluerCool

@BluerCool BluerCool commented Jun 13, 2026

Copy link
Copy Markdown

Fix 13 bugs found through code analysis, plus CI/build fixes:

Resource leaks:

  • opendir() handle never closed in generatedEntryIndex() (clipboard.cpp)
  • File descriptors leaked in atexit handler (utils.cpp)

Undefined behavior:

  • Iterator invalidation in ignoreItemsPreemptively() and convertFromGUIClipboard() - erasing from vector during range-for loop
  • Base64 out-of-bounds access when content size not multiple of 4
  • Substring underflow when response < 2 chars in getRemoteClipboard()
  • Unsigned underflow in displaySearchJSON() and history entry length calculation

Logic errors:

  • notePipe() overwrites note with empty content when run via command substitution
  • displaySearchJSON() skips first result (off-by-one)
  • Format specifier %d for unsigned long in clear.cpp
  • Signed/unsigned comparison in search.cpp, formatting.cpp, history.cpp
  • Bitwise | instead of logical || in preprocessor

Build/CI fixes:

  • Windows: install OpenSSL via vcpkg and use toolchain file for proper linking
  • BSD: upgrade cross-platform-actions from v0.13.0 to v1.2.0 to fix SSH failures
  • Update FreeBSD/OpenBSD/NetBSD versions

All 31 integration tests pass.

…ing include, and note function trailing newline handling
@BluerCool BluerCool changed the title Fix bugs in Clipboard project Fix multiple bugs: resource leaks, UB, and logic errors Jun 13, 2026
@BluerCool BluerCool changed the title Fix multiple bugs: resource leaks, UB, and logic errors Fix multiple bugs: resource leaks, UB, logic errors, and CI fixes Jun 13, 2026
OpenCode Developer added 3 commits June 13, 2026 16:19
… pipe handling

- Fix opendir() resource leak in generatedEntryIndex()
- Fix file descriptor leak in atexit handler (utils.cpp)
- Fix iterator invalidation in ignoreItemsPreemptively() and convertFromGUIClipboard()
- Fix format specifier mismatch in clear.cpp (%d -> %lu)
- Fix unsigned underflow in displaySearchJSON() and history entry length
- Fix signed/unsigned comparison in search.cpp, formatting.cpp, history.cpp
- Fix base64 out-of-bounds access in fromBase64()
- Fix substring underflow in getRemoteClipboard()
- Fix bitwise OR in preprocessor directive
- Fix notePipe() to read note when no pipe data is available
- windows-amd64: Install openssl:x64-windows via vcpkg
- windows-arm64: Add -DCMAKE_TOOLCHAIN_FILE for vcpkg integration
- Both jobs now properly pass vcpkg toolchain to CMake so OpenSSL::Crypto is found
…ures

- Upgrade cross-platform-actions/action from v0.13.0 to v1.2.0
- Switch to new API: use cpa.sh default shell + separate Start VM step
- Update FreeBSD to 14.2, OpenBSD to 7.6, NetBSD to 10.1
- v0.13.0 had persistent SSH connection failures on newer runners
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