Bug 1369361 - Backport SQLite fix removing rand_s() in an attempt to avoid Lenovo DLL crashes. r?mak
SQLite check-in 3a2793aa:
https://www.sqlite.org/src/info/3a2793aa65727cbb
MozReview-Commit-ID: 1Q4tGhWLoRu
--- a/db/sqlite3/src/sqlite3.c
+++ b/db/sqlite3/src/sqlite3.c
@@ -822,23 +822,16 @@ SQLITE_PRIVATE const char **sqlite3Compi
/*
** Make sure the Tcl calling convention macro is defined. This macro is
** only used by test code and Tcl integration code.
*/
#ifndef SQLITE_TCLAPI
# define SQLITE_TCLAPI
#endif
-/*
-** Make sure that rand_s() is available on Windows systems with MSVC 2005
-** or higher.
-*/
-#if defined(_MSC_VER) && _MSC_VER>=1400
-# define _CRT_RAND_S
-#endif
/*
** Include the header file used to customize the compiler options for MSVC.
** This should be done first so that it can successfully prevent spurious
** compiler warnings due to subsequent content in this file and other files
** that are included by this file.
*/
/************** Include msvc.h in the middle of sqliteInt.h ******************/
@@ -43922,19 +43915,16 @@ static int winRandomness(sqlite3_vfs *pV
#if defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS)
UNUSED_PARAMETER(pVfs);
memset(zBuf, 0, nBuf);
return nBuf;
#else
EntropyGatherer e;
UNUSED_PARAMETER(pVfs);
memset(zBuf, 0, nBuf);
-#if defined(_MSC_VER) && _MSC_VER>=1400 && !SQLITE_OS_WINCE
- rand_s((unsigned int*)zBuf); /* rand_s() is not available with MinGW */
-#endif /* defined(_MSC_VER) && _MSC_VER>=1400 */
e.a = (unsigned char*)zBuf;
e.na = nBuf;
e.nXor = 0;
e.i = 0;
{
SYSTEMTIME x;
osGetSystemTime(&x);
xorMemory(&e, (unsigned char*)&x, sizeof(SYSTEMTIME));