Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003367 [Quercus] minor always 03-03-09 22:57 03-04-09 16:52
Reporter koreth View Status public  
Assigned To nam
Priority normal Resolution fixed  
Status closed   Product Version 4.0.0
Summary 0003367: String indexing fails with binary data
Description <?php
$x = "\x90";
print $x[0];

Throws an exception:

[22:55:30.410] {http--8080-10} java.lang.ArrayIndexOutOfBoundsException: -112
[22:55:30.410] {http--8080-10} at com.caucho.quercus.env.StringBuilderValue.charValueAt(StringBuilderValue.java:733)

The following patch fixes it.

--- a/modules/quercus/src/com/caucho/quercus/env/StringBuilderValue.java
+++ b/modules/quercus/src/com/caucho/quercus/env/StringBuilderValue.java
@@ -728,7 +728,7 @@ public class StringBuilderValue
     if (index < 0 || len <= index)
       return UnsetStringValue.UNSET;
     else {
- byte ch = _buffer[(int) index];
+ int ch = _buffer[(int) index] & 0xff;
 
       return CHAR_STRINGS[ch];
     }
Additional Information
Attached Files

- Relationships

- Notes
(0003861)
nam
03-04-09 16:52

php/04a1
 

- Issue History
Date Modified Username Field Change
03-03-09 22:57 koreth New Issue
03-04-09 16:51 nam Status new => assigned
03-04-09 16:51 nam Assigned To  => nam
03-04-09 16:52 nam Status assigned => closed
03-04-09 16:52 nam Note Added: 0003861
03-04-09 16:52 nam Resolution open => fixed
03-04-09 16:52 nam Fixed in Version  => 4.0.0


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker