@@ -203,6 +203,17 @@ TEST_CASE("malformed bulk string(3)", "[protocol]") {
203203 REQUIRE (r->code .message () == " Terminator for bulk string not found" );
204204};
205205
206+ TEST_CASE (" malformed bulk string(4)" , " [protocol]" ) {
207+ using Policy = r::parsing_policy::drop_result;
208+ std::string ok =
209+ " $4555555555555555555555555555555555555555555555555555\r\n somemm" ;
210+ Buffer buff (ok.c_str (), ok.size ());
211+ auto from = Iterator::begin (buff), to = Iterator::end (buff);
212+ auto parsed_result = r::Protocol::parse<Iterator, Policy>(from, to);
213+ r::protocol_error_t *r = boost::get<r::protocol_error_t >(&parsed_result);
214+ REQUIRE (r->code .message () == " Cannot convert count to number" );
215+ };
216+
206217TEST_CASE (" empty array" , " [protocol]" ) {
207218 std::string ok = " *0\r\n " ;
208219 Buffer buff (ok.c_str (), ok.size ());
@@ -241,6 +252,15 @@ TEST_CASE("malformed array", "[protocol]") {
241252 REQUIRE (r->code .message () == " Unacceptable count value" );
242253};
243254
255+ TEST_CASE (" malformed array (2)" , " [protocol]" ) {
256+ std::string ok = " *555555555555555555555555555555555555555\r\n some\r\n " ;
257+ Buffer buff (ok.c_str (), ok.size ());
258+ auto from = Iterator::begin (buff), to = Iterator::end (buff);
259+ auto parsed_result = r::Protocol::parse (from, to);
260+ r::protocol_error_t *r = boost::get<r::protocol_error_t >(&parsed_result);
261+ REQUIRE (r->code .message () == " Cannot convert count to number" );
262+ };
263+
244264TEST_CASE (" patrial array(1)" , " [protocol]" ) {
245265 std::string ok = " *1\r\n " ;
246266 Buffer buff (ok.c_str (), ok.size ());
0 commit comments