Infinite loop in ByteBuffer.get/putString()
-------------------------------------------

         Key: DIRMINA-141
         URL: http://issues.apache.org/jira/browse/DIRMINA-141
     Project: Directory MINA
        Type: Bug
    Versions: 0.8.1, 0.8    
    Reporter: Trustin Lee
 Assigned to: Trustin Lee 
     Fix For: 0.8.2


expectedLength local variable in ByteBuffer.get/putString() is sometimes 
calculated as '0', and it causes infinite loop in case of buffer overflow:

int expectedLength = (int) (in.remaining() * encoder.averageBytesPerChar());

This problem can be fixed easily by adding 1 to expectedLength:

int expectedLength = (int) (in.remaining() * encoder.averageBytesPerChar()) + 1;

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

Reply via email to