Skip to content

Commit

Permalink
Merge pull request #184 from Koromix/fix_ub_function_pointer_cast
Browse files Browse the repository at this point in the history
Fix undefined behavior related to function pointer cast
  • Loading branch information
utelle authored Dec 10, 2024
2 parents b6ee0c9 + d2964e5 commit 08edcd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/cipher_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ sqlite3mcCloneCodecParameterTable()
}

SQLITE_PRIVATE void
sqlite3mcFreeCodecParameterTable(CodecParameter* codecParams)
sqlite3mcFreeCodecParameterTable(void* ptr)
{
CodecParameter* codecParams = (CodecParameter*)ptr;
sqlite3_free(codecParams[0].m_params);
sqlite3_free(codecParams);
}
Expand Down
2 changes: 1 addition & 1 deletion src/sqlite3mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ mcRegisterCodecExtensions(sqlite3* db, char** pzErrMsg, const sqlite3_api_routin
if (rc == SQLITE_OK)
{
rc = sqlite3_create_function_v2(db, "sqlite3mc_config_table", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC,
codecParameterTable, sqlite3mcConfigTable, 0, 0, (void(*)(void*)) sqlite3mcFreeCodecParameterTable);
codecParameterTable, sqlite3mcConfigTable, 0, 0, sqlite3mcFreeCodecParameterTable);
}

rc = (codecParameterTable != NULL) ? SQLITE_OK : SQLITE_NOMEM;
Expand Down

0 comments on commit 08edcd9

Please sign in to comment.