Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 861102a

Browse files
committed
Fixed HHVM-179: Throw exception if WriteConcern wtimeout is out of range
1 parent 291b199 commit 861102a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/MongoDB/Driver/WriteConcern.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ void HHVM_METHOD(MongoDBDriverWriteConcern, __construct, const Variant &w, const
9494
throw MongoDriver::Utils::throwInvalidArgumentException((char*) wtimeout_error.toString().c_str());
9595
}
9696

97+
if (wtimeout_int > INT32_MAX) {
98+
StringBuffer buf;
99+
100+
buf.printf(
101+
"Expected wtimeout to be <= %d, %ld given",
102+
INT32_MAX,
103+
wtimeout_int
104+
);
105+
Variant wtimeout_error = buf.detach();
106+
throw MongoDriver::Utils::throwInvalidArgumentException((char*) wtimeout_error.toString().c_str());
107+
}
108+
97109
mongoc_write_concern_set_wtimeout(data->m_write_concern, wtimeout_int);
98110
}
99111

0 commit comments

Comments
 (0)