Skip to content

Commit 1bb7240

Browse files
committed
PHPC-1629: Check if read preference is valid during unserialization
1 parent a520c00 commit 1bb7240

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/MongoDB/ReadPreference.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ static bool php_phongo_readpreference_init_from_hash(php_phongo_readpreference_t
138138
}
139139
}
140140

141+
if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
142+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Read preference is not valid");
143+
goto failure;
144+
}
145+
141146
return true;
142147

143148
failure:

0 commit comments

Comments
 (0)