Opened 4 years ago

Closed 4 years ago

#1603 closed defect (fixed)

Bote: AIOOBE

Reported by: user Owned by: str4d
Priority: minor Milestone: 0.9.23
Component: apps/plugins Version: 0.9.20
Keywords: I2P-Bote Cc:
Parent Tickets:

Description

I sometimes get 0 size files and those trigger errors liek this one:

6/12/15 4:11:39 PM ERROR [ExpiratnThrd?] i2p.bote.folder.Folder : Can't create a FolderElement? from file: /path/to/.i2p/i2pbote/dht_index_pkt/nW6uWINdi~5TqZKzkG~YhzLf8evLrF0IWkqHpR091Rg=.pkt (file size=0)

java.lang.ArrayIndexOutOfBoundsException?: 0
at i2p.bote.packet.CommunicationPacket?.isPrefixValid(CommunicationPacket?.java:122)
at i2p.bote.packet.I2PBotePacket.createPacket(I2PBotePacket.java:115)
at i2p.bote.packet.I2PBotePacket.createPacket(I2PBotePacket.java:90)
at i2p.bote.folder.PacketFolder?.createFolderElement(PacketFolder?.java:85)
at i2p.bote.folder.PacketFolder?.createFolderElement(PacketFolder?.java:42)
at i2p.bote.folder.Folder$3.findNextElement(Folder.java:170)
at i2p.bote.folder.Folder$3.next(Folder.java:151)
at i2p.bote.folder.PacketFolder?$1.next(PacketFolder?.java:106)
at i2p.bote.folder.PacketFolder?$1.next(PacketFolder?.java:90)
at i2p.bote.folder.IndexPacketFolder?.deleteExpired(IndexPacketFolder?.java:99)
at i2p.bote.service.ExpirationThread?.run(ExpirationThread?.java:53)

Subtickets

Change History (4)

comment:1 Changed 4 years ago by zzz

  • Component changed from other to apps/plugins
  • Owner set to str4d
  • Status changed from new to assigned

comment:2 Changed 4 years ago by kay

In order to prevent this IAOOBE and a possible NPE check for null and packet array length.

in/java/i2p/bote/packet/CommunicationPacket.java 
#
# old_revision [0d6505d2805dff9774d816a899b6463074057c15]
#
# patch "src/main/java/i2p/bote/packet/CommunicationPacket.java"
#  from [bb37a2da9cb08fdc7656f3daf0d17e3e4c008c0f]
#    to [53b933a1f8fb872af0e0d95929509f51ac9eb456]
#
============================================================
--- src/main/java/i2p/bote/packet/CommunicationPacket.java	bb37a2da9cb08fdc7656f3daf0d17e3e4c008c0f
+++ src/main/java/i2p/bote/packet/CommunicationPacket.java	53b933a1f8fb872af0e0d95929509f51ac9eb456
@@ -118,6 +118,8 @@ public abstract class CommunicationPacke
      * @param packet
      */
     static boolean isPrefixValid(byte[] packet) {
+        if(null == packet || packet.length < PACKET_PREFIX.length)
+            return false;
         for (int i=0; i<PACKET_PREFIX.length; i++)
             if (packet[i] != PACKET_PREFIX[i])
                 return false;

comment:3 Changed 4 years ago by kay

  • Keywords I2P-Bote needs_review added

comment:4 Changed 4 years ago by str4d

  • Keywords needs_review removed
  • Milestone changed from undecided to 0.9.23
  • Resolution set to fixed
  • Status changed from assigned to closed

Fixes in 6b51a1f56403aeddc800bccf982181cebb65beae.

Note: See TracTickets for help on using tickets.