From 98ab2b5a265e4794d6a9d22212d992bfd1f9c1f1 Mon Sep 17 00:00:00 2001 From: Robert Backhaus Date: Wed, 29 May 2013 10:33:36 +1000 Subject: [PATCH] Don't attempt to resize vector to negative size. --- src/db.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/db.cpp b/src/db.cpp index 3133d99b..fd4c67d5 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 vchData; vchData.resize(dataSize); uint256 hashIn;