reckart opened a new issue, #304:
URL: https://github.com/apache/uima-uimaj/issues/304

   **Describe the bug**
   There is a very rare bug in deserializing a CAS when the last element on the 
heap is an empty array and the heap and there is no additional space on the 
heap after that element.
   
   **To Reproduce**
   TBH, I have no idea how to really reproduce this. But here is what happens:
   
   **BinaryCasSerDes.java**
   ```
        heapIndex=254
        heap.heap.length=256
   ----
         if (type.isArray()) {
           final int len = heap.heap[heapIndex + arrayLengthFeatOffset]; // We 
get the length of the array -> 0
           final int bhi = heap.heap[heapIndex + arrayContentOffset]; // We get 
the pointer(?) to the start of the array 254+2 -> CRASH
   ```
   
   The code crashes with an `IndexOutOfBoundsException` because `heapIndex + 
arrayContentOffset >= heap.heap.length`. However, we do not really need `bhi` 
because the array is empty and thus we won't read its contents anyway.
   
   **Expected behavior**
   If the array is empty, skip `bhi` and related core entirely.
   
   **Please complete the following information:**
    - Version: 3.4.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@uima.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to