Skip to content

Commit

Permalink
CDataStream::ignore Throw exception instead of assert on negative nSize.
Browse files Browse the repository at this point in the history
Previously disk corruption would cause an assert instead of an exception.
  • Loading branch information
pstratem authored and sipa committed Apr 25, 2016
1 parent 4f87af6 commit 4bf631e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/streams.h
Expand Up @@ -240,7 +240,9 @@ class CDataStream
CDataStream& ignore(int nSize)
{
// Ignore from the beginning of the buffer
assert(nSize >= 0);
if (nSize < 0) {
throw std::ios_base::failure("CDataStream::ignore(): nSize negative");
}
unsigned int nReadPosNext = nReadPos + nSize;
if (nReadPosNext >= vch.size())
{
Expand Down

0 comments on commit 4bf631e

Please sign in to comment.