summaryrefslogtreecommitdiff
path: root/db/pdfile.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-12-24 13:31:46 -0500
committerEliot Horowitz <eliot@10gen.com>2010-12-24 13:33:24 -0500
commit19b8c2be8ac44b717e1c7adb8083bd5d744d5683 (patch)
tree2532178b880f5a9b6b810d2a6427dec7126d55e3 /db/pdfile.cpp
parentee36889eefb700aa119062b3cf5ba273762444f3 (diff)
downloadmongo-19b8c2be8ac44b717e1c7adb8083bd5d744d5683.tar.gz
fix follow up extent sizing when an int overflow SERVER-2287
Diffstat (limited to 'db/pdfile.cpp')
-rw-r--r--db/pdfile.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/db/pdfile.cpp b/db/pdfile.cpp
index c9fe229d7c1..70d654c7c3a 100644
--- a/db/pdfile.cpp
+++ b/db/pdfile.cpp
@@ -1013,10 +1013,14 @@ namespace mongo {
int y = (int) (lastExtentLen < 4000000 ? lastExtentLen * 4.0 : lastExtentLen * 1.2);
int sz = y > x ? y : x;
- if ( sz < lastExtentLen )
- sz = lastExtentLen;
- else if ( sz > Extent::maxSize() )
+ if ( sz < lastExtentLen ){
+ // this means there was an int overflow
+ // so we should turn it into maxSize
sz = Extent::maxSize();
+ }
+ else if ( sz > Extent::maxSize() ){
+ sz = Extent::maxSize();
+ }
sz = ((int)sz) & 0xffffff00;
assert( sz > len );