Hey guys,
I just submitted this bug to Motorola. Anyone developing for the T720 should watch out for this as I lost a day trying to nail it down. Note that this only works on the phone: no emulators reproduce it.
The problem is that Graphics.drawString() isn't properly clipped. Drawing a string near the bottom edge of an image appears to corrupt memory and will crash the KVM once you try to do anything important with it.
Sample code:
1 2 3
| Image img = Image.createImage(50, 4); img.getGraphics().drawString("Howdy", 5, 7, Graphics.LEFT|Graphics.BASELINE); Image.createImage(img); |
If someone here is clever enough to use this bug to write to the memory space outside the KVM and hijack the phone, please post your results in this thread. :)