Thread: RuneSource 484

Results 1 to 4 of 4
  1. #1 RuneSource 484 
    Banned
    Join Date
    Jan 2013
    Posts
    132
    Thanks given
    23
    Thanks received
    36
    Rep Power
    0
    Im trying to get the ondemand working but I receive a BufferOverflowException


    Code:
    java.nio.BufferOverflowException
    	at java.nio.Buffer.nextPutIndex(Unknown Source)
    	at java.nio.HeapByteBuffer.put(Unknown Source)
    	at org.runesource.net.Client.handleLogin(Client.java:310)
    	at org.runesource.net.Client.handleIncomingData(Client.java:119)
    	at org.runesource.net.DedicatedReactor.run(DedicatedReactor.java:47)
    Code:
    	case ONDEMAND:
    			if (inData.remaining() < 4) {
    				inData.compact();
    				return;
    			}
    			
    			int opcode = inData.get() & 0xFF;
    			if (opcode == 0 || opcode == 1) {
    				int type = inData.get() & 0xFF;
    				int file = inData.getShort() & 0xFFFF;
    				
    				ByteBuffer buffer;
    				Cache cache = Server.getSingleton().getCache();
    				
    				if (type == 255 && file == 255) {
    					
    					ChecksumTable table = Server.getSingleton().getChecksumTable();
    					Container container = new Container(Container.COMPRESSION_NONE, table.encode());
    					buffer = ByteBuffer.wrap(container.encode().array());
    				} else {
    					buffer = ByteBuffer.wrap(cache.getStore().read(type, file).array());
    					if (type != 255)
    						buffer = buffer.slice();
    				}
    				
    				buffer.put((byte) type);
    				buffer.putShort((short) file);
    
    				int compression = buffer.get() & 0xFF;
    				if (opcode == 1)
    					compression |= 0x80;
    
    				buffer.put((byte) compression);
    
    				int bytes = buffer.remaining();
    				if (bytes > 508)
    					bytes = 508;
    
    				buffer.put(buffer.get(bytes));
    
    				for (;;) {
    					bytes = buffer.remaining();
    					if (bytes == 0)
    						break;
    					else if (bytes > 511)
    						bytes = 511;
    
    					buffer.put((byte) 0xFF);
    					buffer.put(buffer.get(bytes));
    				}		
    				send(buffer);
    			}
    			break;
    if you need to see anything else let me know
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jan 2010
    Posts
    3,665
    Thanks given
    533
    Thanks received
    918
    Rep Power
    0
    Code:
    at org.runesource.net.Client.handleLogin(Client.java:310)
    What is the code at that line.
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jan 2013
    Posts
    132
    Thanks given
    23
    Thanks received
    36
    Rep Power
    0
    Quote Originally Posted by Arsenic View Post
    Code:
    at org.runesource.net.Client.handleLogin(Client.java:310)
    What is the code at that line.
    buffer.put(buffer.get(bytes));
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jan 2010
    Posts
    3,665
    Thanks given
    533
    Thanks received
    918
    Rep Power
    0
    Quote Originally Posted by Khasck View Post
    buffer.put(buffer.get(bytes));
    Have you not exceeded the limit of the buffer and must you not increase the pre-allocated size? I am not familiar on these topics so incoming flame is expected but these are my thoughts.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 43
    Last Post: 02-06-2013, 08:04 AM
  2. RuneSource 317
    By blakeman8192 in forum Projects
    Replies: 318
    Last Post: 03-18-2012, 07:54 PM
  3. [runesource] compiling error [runesource]
    By cruel ko in forum Help
    Replies: 0
    Last Post: 06-10-2011, 12:00 PM
  4. Replies: 5
    Last Post: 04-04-2011, 11:54 PM
  5. [613+] RuneSource [613+]
    By vtothef in forum Projects
    Replies: 4
    Last Post: 10-29-2010, 06:16 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •