IntelLabs / vdms

VDMS: Your Favorite Visual Data Management System
MIT License
84 stars 31 forks source link

Server crash with malformed query (FindEntity) #98

Closed isclayton closed 5 years ago

isclayton commented 5 years ago

Not sure if FindEntity is intended to support query by "type" property, but in any event, this crashes the server (Running docker container intellabs/vdms:latest)

To reproduce:

Send FindEntity query like:


"FindEntity" : {
         "class" : "Hike", 
         "constraints" : {
             "type" : [] 
         }

While this query has no type value, I think you can reproduce by providing values as well. Error:

vdms: src/PMGDQuery.cc:339: void VDMS::PMGDQuery::parse_query_constraints(const Json::Value&, VDMS::PMGDQueryConstraints*): Assertion `predicate.size() == 2 || predicate.size() == 4' failed.

Looks like some additional validation is needed, but I haven't dug too deep into it.

vishakha041 commented 5 years ago

Thank you for that easily reproducible example and the line where it fails. "constraints" block lets you specify values to compare for a given property key. The json array in your example is missing what to compare with. However, this shouldn't crash the server. Should just return an error.