Fix builds with assertions enabled (#307)
What changed, and why it matters
This commit fixes two assertion-related bugs that only appear when the software is compiled with assertions enabled. One fixes a stale variable name in a sanity check, and the other removes an incorrect size comparison that would falsely trigger during normal operation. Neither change addresses a security vulnerability; they are build/compile fixes and removal of a buggy debug check.
No security action required. Treat as a normal build-fix commit. If assertions are enabled in production builds, consider validating that the removed assert did not mask any real out-of-bounds behavior, though the remaining checks appear sufficient.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch makes two assertion-only changes. In src/scanner.cpp, it updates an assert to reference lws_server.address instead of the removed lws_server_addr, restoring compilation when assertions are enabled. In src/rpc/light_wallet.cpp, it removes an assert in vec_lmdb_::get_value() that compared a byte size (sizeof(G) + uoffset) against a remaining element count (end - pos), which is semantically wrong and would fire on valid inputs such as /feed updates with two outputs. The remaining static_assert and assert(!is_end()) still guard the operation. These are correctness fixes for debug builds, not runtime security fixes.
Changed components
src/scanner.cppsrc/rpc/light_wallet.cppInspect captured patch +1 / −2
### src/rpc/light_wallet.cpp
@@ -573,7 +573,6 @@ namespace lws
static_assert(std::is_trivially_copyable<U>(), "value type must be memcpy safe");
static_assert(std::is_trivially_copyable<G>(), "field type must be memcpy safe");
static_assert(sizeof(G) + uoffset <= sizeof(U), "bad field and/or offset");
- assert(sizeof(G) + uoffset <= end - pos);
assert(!is_end());
G value;
### src/scanner.cpp
@@ -673,7 +673,7 @@ namespace lws
const scanner_options& opts)
{
assert(users.size() == active.size());
- assert(thread_count || !lws_server_addr.empty());
+ assert(thread_count || !lws_server.address.empty());
assert(!thread_count || !users.empty());
std::vector<boost::thread> threads{};Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.