-
Bug
-
Resolution: Fixed
-
P2
-
1.2.0
Name: akC57697 Date: 07/07/97
The java.io.ByteArrayOutputStream.write([],int,int) causes
segmentation violation with parameters out of bounds instead of
IndexOutOfBoundsException ( or OutOfMemoryException)
--------------------------- Test.java --------------------
import java.io.*;
public class Test {
public static void main(String[] args) {
ByteArrayOutputStream y1;
byte array1[]={49,50,51,52,53};
y1 = new ByteArrayOutputStream(100);
for (int i=0;i<3;i++) {
try {
y1.write(array1,0,Integer.MAX_VALUE-i); // It is works without "-i"
} catch (IndexOutOfBoundsException e)
{ System.out.println("OKAY");
}
catch (Throwable e)
{ System.out.println("Unexpected "+e);
}
y1.reset();
}
}
}
---------------------------Output--------------------
Unexpected java.lang.OutOfMemoryError
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]: Error 0
si_code [1]: SEGV_ACCERR [addr: 0x6db720fc]
stackbase=F0000000, stackpointer=EFFFEE44
Full thread dump:
"Finalizer" (TID:0xedafa3e0, sys_thread_t:0x52fbc, state:CW, thread_t: t@6, sp:0x0, stack_bottom:0xeeb94000, stack_size:0x22000) prio=1
java.lang.Ref$Queue.remove(Ref.java:114)
java.lang.Ref$Queue.remove(Ref.java:121)
java.lang.Finalizer$FinalizerThread.run(Finalizer.java:136)
"Ref handler" (TID:0xedafa1b8, sys_thread_t:0x4c3d4, state:CW, thread_t: t@5, sp:0x0, stack_bottom:0xeebc4000, stack_size:0x22000) prio=10
java.lang.Object.wait(Object.java:315)
java.lang.Ref$RefHandler.run(Ref.java:149)
"SIGQUIT handler" (TID:0xedafa060, sys_thread_t:0x9be7c, state:R, thread_t: t@4, sp:0x0, stack_bottom:0xeebf4000, stack_size:0x22000) prio=0
"main" (TID:0xedafa090, sys_thread_t:0x21404, state:R, thread_t: t@1, sp:0x0, stack_bottom:0xf0000000, stack_size:0x800000) prio=5 *current thread*
java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:95)
Test.main(Test.java:16)
Monitor Cache Dump:
java.lang.Object@EDAFA1C8/EDB52CA0: <unowned>
Waiting to be notified:
"Ref handler"
java.lang.Object@EDAFA3F8/EDB556A8: <unowned>
Waiting to be notified:
"Finalizer"
java.io.ByteArrayOutputStream@EDAFF038/EDB6BC70: owner "main" (0x21404, 1 entry)
Registered Monitor Dump:
Thread queue lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Monitor cache expansion lock: <unowned>
Monitor registry: owner "main" (0x21404, 1 entry)
Abort (core dumped)
----------------------------------------------------------
======================================================================
- relates to
-
JDK-4017158 java.io.ByteArrayOutputStream.write(b,off,len) works wrong with big len
- Closed