Bug 1: 3-argument call to 2-parameter function
In sqlite3mc_amalgamation.c line 335796:
sqlite3mcSecureZeroMemory(pPrior, 0, nSize);
sqlite3mcSecureZeroMemory takes (void*, size_t) — two parameters. The 0 is interpreted as the size, making this a zero-byte wipe (no-op). nSize is silently ignored. This means the entire SQLITE3MC_SECURE_MEMORY free path wipes nothing.
Fix: sqlite3mcSecureZeroMemory(pPrior, nSize);
Bug 2: Plain memset on key material before sqlite3_free
All Free*Cipher functions (FreeAES128Cipher, FreeAES256Cipher, FreeChaCha20Cipher, FreeSQLCipherCipher, FreeRC4Cipher, FreeAscon128Cipher, FreeAegisCipher) and sqlite3mcCodecTerm use memset() to clear key material (m_key, m_hmacKey, m_salt, Rijndael state) before freeing. Compilers are permitted to elide memset on dead stores (memory freed immediately after), so key material may persist in freed heap memory.
These should use sqlite3mcSecureZeroMemory instead.
Affected lines (approximate, in amalgamation): 329041, 329043, 329334, 329336, 329599, 330043, 330045, 330486, 331894, 332369, 332909, 332916.