diff options
| author | Robert Backhaus <[email protected]> | 2013-05-29 10:33:36 +1000 |
|---|---|---|
| committer | Robert Backhaus <[email protected]> | 2013-05-29 12:12:33 +1000 |
| commit | 98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1 (patch) | |
| tree | e8465162aa177b50cb2eaa384af64375aae6fda0 /src/db.cpp | |
| parent | Merge pull request #2696 from robbak/util_h-Add_stdarg_include (diff) | |
| download | discoin-98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1.tar.xz discoin-98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1.zip | |
Don't attempt to resize vector to negative size.
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/db.cpp b/src/db.cpp index 3133d99bf..fd4c67d55 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -541,6 +541,8 @@ bool CAddrDB::Read(CAddrMan& addr) // use file size to size memory buffer int fileSize = GetFilesize(filein); int dataSize = fileSize - sizeof(uint256); + //Don't try to resize to a negative number if file is small + if ( dataSize < 0 ) dataSize = 0; vector<unsigned char> vchData; vchData.resize(dataSize); uint256 hashIn; |