freestrings / jsonpath

JsonPath engine written in Rust. Webassembly and Javascript support too
MIT License
122 stars 37 forks source link

Crash on jsonpath accesing null address #76

Open gkorland opened 3 years ago

gkorland commented 3 years ago

The following path "$.store.book[?(@.authors[0:].lastName)]" crash due to Accessing address: (nil)

Example JSON:

{
    "store": {
        "book": [
            {
                "authors": [
                    {
                        "firstName": "Nigel",
                        "lastName": "Rees"
                    },
                    {
                        "firstName": "Evelyn",
                        "lastName": "Waugh"
                    }
                ],
                "title": "Sayings of the Century"
            },
            {
                "authors": [
                    {
                        "firstName": "Herman",
                        "lastName": "Melville"
                    },
                    {
                        "firstName": "Somebody",
                        "lastName": "Else"
                    }
                ],
                "title": "Moby Dick"
            }
        ]
    }
}
MeirShpilraien commented 3 years ago

Failing because of:

if !self.selector_filter.is_term_empty() {
            unimplemented!("range syntax in filter");
        }

https://github.com/RedisJSON/jsonpath/blob/ddb3b2db3345b31a4251ad1fbfb0f75732f6e189/src/select/mod.rs#L828