[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5453) ByteCodeHelper.readByteCode won't load classes bigger than a constant size

Marcos Pernambuco (JIRA) noreply at atlassian.com
Tue Aug 10 00:09:40 EDT 2010


ByteCodeHelper.readByteCode won't load classes bigger than a constant size
--------------------------------------------------------------------------

                 Key: HHH-5453
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5453
             Project: Hibernate Core
          Issue Type: Patch
          Components: core
    Affects Versions: 3.6.0.Beta2, 3.6.0.Beta1, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.0-Final, 3.5.0-CR-2, 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1, 3.3.2, 3.3.1
            Reporter: Marcos Pernambuco
         Attachments: ByteCodeHelper.readByteCode.svn.diff

Although it is unlikely that a class will have more than 409600 bytes, ByteCodeHelper.readByteCode() will fail in this case.
The programmer's intention was clear: handle any file size; but he or she forgot to add a call to inputStream.read() at the end of the loop

...
r = inputStream.read( buffer );
while ( r >= buffer.length ) {
	byte[] temp = new byte[ classBytes.length + buffer.length ];
	System.arraycopy( classBytes, 0, temp, 0, classBytes.length );
	System.arraycopy( buffer, 0, temp, classBytes.length, buffer.length );
	classBytes = temp;
        // THERE SHOULD BE A "r = inputStream.read( buffer )" HERE
}
...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list