eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
427 stars 179 forks source link

Treat as expr can crash eXist-db #1972

Open adamretter opened 6 years ago

adamretter commented 6 years ago

The following very simple query from the XQTS 3.1 will result in a java.lang.StackOverflowError.

3 treat as item()+ + +1

It should also be considered as a security issue. This simple query could be sent to the REST end-point of any eXist-db server (which exposes the service), and it will cause the JVM to shutdown.

The XQTS states that we can should return the value 4, or any error code. So we can decide what we want to do here.

duncdrum commented 6 years ago

In dubio pro 4