From c0f2ee61eee94395c7cf925baf5ac8ed44abecee Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 30 Apr 2009 19:34:47 +0200 Subject: [PATCH] Throw an exception if seeking to invalid positions is requested in the memory IO class. --- src/common/mm_io.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index 621e7b1ca..2c0a394a8 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -980,12 +980,10 @@ mm_mem_io_c::setFilePointer(int64 offset, else npos = pos + offset; - if (npos < 0) - pos = 0; - else if (npos >= mem_size) - pos = mem_size; - else + if ((0 <= npos) && (mem_size >= npos)) pos = npos; + else + throw mm_io_seek_error_c(); } uint32