Bug 1369361 - Backport SQLite fix removing rand_s() in an attempt to avoid Lenovo DLL crashes. r?mak draft
authorChris Peterson <cpeterson@mozilla.com>
Tue, 12 Sep 2017 12:58:59 -0700
changeset 664492 72639b42986761f91150844572878a876a82b242
parent 664491 c15e2f280729b6503f9455cd4448ab2852eb5806
child 731460 386618c2297337b4f784a1ecfcf06aba6bc98b92
push id79712
push usercpeterson@mozilla.com
push dateThu, 14 Sep 2017 00:51:19 +0000
reviewersmak
bugs1369361
milestone57.0a1
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
db/sqlite3/src/sqlite3.c
--- 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));