Merge pull request #625

7e65cc0 MDB_VL32 Fix off-by-one in mdb_midl_shrink (Howard Chu)
222e30e MDB_VL32 Fix another 32bit overflow (Howard Chu)
3ca6e85 Tweak mdb_strerror msg buffer (Howard Chu)
78ad970 MDB_VL32 Fix d2a5f72f73 (Howard Chu)
2aa0b3b updated gtest (added missing files) (Riccardo Spagni)
83d586c updated gtest (Riccardo Spagni)
fdc10ff even more typos (Henning Kopp)
da5415a more typos fixed (Henning Kopp)
a8c6f15 fixed typo (Henning Kopp)
423c7fe simplewallet: remove leftover command line refresh-type handling (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2016-01-28 11:26:04 +02:00
commit ae8afe4256
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
2 changed files with 7 additions and 6 deletions

View File

@ -1572,8 +1572,9 @@ mdb_strerror(int err)
* This works as long as no function between the call to mdb_strerror * This works as long as no function between the call to mdb_strerror
* and the actual use of the message uses more than 4K of stack. * and the actual use of the message uses more than 4K of stack.
*/ */
char pad[4096]; #define MSGSIZE 1024
char buf[1024], *ptr = buf; #define PADSIZE 4096
char buf[MSGSIZE+PADSIZE], *ptr = buf;
#endif #endif
int i; int i;
if (!err) if (!err)
@ -1605,7 +1606,7 @@ mdb_strerror(int err)
buf[0] = 0; buf[0] = 0;
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, ptr, sizeof(buf), (va_list *)pad); NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE);
return ptr; return ptr;
#else #else
return strerror(err); return strerror(err);
@ -2428,7 +2429,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp)
rc = MDB_MAP_FULL; rc = MDB_MAP_FULL;
goto fail; goto fail;
} }
#ifdef _WIN32 #if defined(_WIN32) && !defined(MDB_VL32)
if (!(env->me_flags & MDB_RDONLY)) { if (!(env->me_flags & MDB_RDONLY)) {
void *p; void *p;
p = (MDB_page *)(env->me_map + env->me_psize * pgno); p = (MDB_page *)(env->me_map + env->me_psize * pgno);
@ -4272,7 +4273,7 @@ mdb_env_set_mapsize(MDB_env *env, mdb_size_t size)
size = meta->mm_mapsize; size = meta->mm_mapsize;
{ {
/* Silently round up to minimum if the size is too small */ /* Silently round up to minimum if the size is too small */
size_t minsize = (meta->mm_last_pg + 1) * env->me_psize; mdb_size_t minsize = (meta->mm_last_pg + 1) * env->me_psize;
if (size < minsize) if (size < minsize)
size = minsize; size = minsize;
} }

View File

@ -120,7 +120,7 @@ void mdb_midl_shrink( MDB_IDL *idp )
{ {
MDB_IDL ids = *idp; MDB_IDL ids = *idp;
if (*(--ids) > MDB_IDL_UM_MAX && if (*(--ids) > MDB_IDL_UM_MAX &&
(ids = realloc(ids, (MDB_IDL_UM_MAX+1) * sizeof(MDB_ID)))) (ids = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID))))
{ {
*ids++ = MDB_IDL_UM_MAX; *ids++ = MDB_IDL_UM_MAX;
*idp = ids; *idp = ids;