Mantis - Quercus
Viewing Issue Advanced Details
5973 crash sometimes 01-14-16 13:28 01-14-16 13:28
bjpeter  
 
normal  
new  
open  
none    
none  
0005973: IndexOutOfBoundsException
This bug manifests itself in version 4.0.39 of Quercus.

Every now and then, we see this stack trace in our log file:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 770
    at java.lang.String.charAt(String.java:646)
    at com.caucho.quercus.lib.db.PDOStatement.parseQueryString(PDOStatement.java:147)
    at com.caucho.quercus.lib.db.PDOStatement.<init>(PDOStatement.java:103)
    at com.caucho.quercus.lib.db.PDO.prepare(PDO.java:514)
    at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.caucho.quercus.env.JavaMethod.invoke(JavaMethod.java:105)
    ... 119 more
After looking at the source code for the PDOStatement class (version 4.0.39), I noticed there is no check if i is less than the length of the query string. There is a check before the call to the charAt method on line 185.

There are no notes attached to this issue.