Transform 3.0. BigDecoder.scanInt() throws an exception

Announcements of bugs and patches for all of Flagstone's Open Source projects.

Moderator: Developers

Transform 3.0. BigDecoder.scanInt() throws an exception

Postby smackay » Fri Nov 26, 2010 3:47 pm

There is a bug in the scanInt() method of com.flagstone.transform.coder.BigDecoder. If there are 2 or 3 bytes left to read the buffer is not refilled and an ArrayIndexOutOfBoundsException is thrown since there is not enough data to read a 32-bit value. The error is in the test of how much space is left in the buffer. The test checks whether there are less than 2 bytes when it should test whether there are less than 4 bytes.

To fix, change line 463 from:
Code: Select all
 if (size - index < 2) {
to
Code: Select all
 if (size - index < 4) {


A patch is attached.

Regards,

Stuart
--
Flagstone Software Ltd.
Attachments
Transform-3.0.BigDecoder-patch.txt
BigDecoder.java
(451 Bytes) Downloaded 210 times
smackay
Site Admin
 
Posts: 594
Joined: Sat Sep 03, 2005 9:04 am

Return to Bugs & Patches

Who is online

Users browsing this forum: No registered users and 1 guest

cron