jumaris / connectbot

Automatically exported from code.google.com/p/connectbot
Apache License 2.0
1 stars 0 forks source link

Opening Large File for public key Import crashses Dalvik #129

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open ConnectBot
2. Open menu -> manage pubkeys -> menu -> import
3. Select large file. I accidentally selected a 30 Mbyte update.zip
4. Dalvik Crashes

What is the expected output? What do you see instead?
 - Error handling to catch an out of memory condition before the app crashes

What version of the product are you using (you can see this by using Menu
-> About in the Host List)?
 - 1.3 (r204 2009.02.18)

Please provide any additional information below.

Output from logcat:
I/dalvikvm-heap(  668): Grow heap (frag case) to 6.384MB for 522256-byte
allocation
D/dalvikvm(  668): GC freed 0 objects / 0 bytes in 128ms
D/dalvikvm(  668): GC freed 3 objects / 260168 bytes in 103ms
I/dalvikvm-heap(  668): Grow heap (frag case) to 7.134MB for 1046544-byte
allocation
D/dalvikvm(  668): GC freed 0 objects / 0 bytes in 123ms
D/dalvikvm(  668): GC freed 3 objects / 522312 bytes in 103ms
I/dalvikvm-heap(  668): Grow heap (frag case) to 8.634MB for 2095120-byte
allocation
D/dalvikvm(  668): GC freed 0 objects / 0 bytes in 215ms
D/dalvikvm(  668): GC freed 3 objects / 1046600 bytes in 108ms
I/ActivityManager(   59): Process com.android.mms (pid 686) has died.
I/dalvikvm-heap(  668): Grow heap (frag case) to 11.634MB for 4192272-byte
allocation
D/dalvikvm(  668): GC freed 0 objects / 0 bytes in 151ms
I/ActivityManager(   59): Process com.android.calendar (pid 502) has died.
D/dalvikvm(  668): GC freed 3 objects / 2095176 bytes in 106ms
I/dalvikvm-heap(  668): Forcing collection of SoftReferences for
8386576-byte allocation
D/dalvikvm(  668): GC freed 0 objects / 0 bytes in 105ms
E/dalvikvm-heap(  668): Out of memory on a 8386576-byte allocation.
I/dalvikvm(  668): "main" prio=5 tid=3 RUNNABLE
I/dalvikvm(  668):   | group="main" sCount=0 dsCount=0 s=0 obj=0x400103e8
I/dalvikvm(  668):   | sysTid=668 nice=0 sched=0/0 handle=-1090986852
I/dalvikvm(  668):   at
java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:~93)
I/dalvikvm(  668):   at
java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:212)
I/dalvikvm(  668):   at
org.connectbot.PubkeyListActivity.readRaw(PubkeyListActivity.java:177)
I/dalvikvm(  668):   at
org.connectbot.PubkeyListActivity$3$1.onClick(PubkeyListActivity.java:245)
I/dalvikvm(  668):   at
com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertControll
er.java:790)
I/dalvikvm(  668):   at
android.widget.AdapterView.performItemClick(AdapterView.java:283)
I/dalvikvm(  668):   at
android.widget.ListView.performItemClick(ListView.java:3055)
I/dalvikvm(  668):   at
android.widget.AbsListView.onKeyUp(AbsListView.java:1519)
I/dalvikvm(  668):   at android.widget.ListView.commonKey(ListView.java:1955)
I/dalvikvm(  668):   at android.widget.ListView.onKeyUp(ListView.java:1864)
I/dalvikvm(  668):   at android.view.KeyEvent.dispatch(KeyEvent.java:720)
I/dalvikvm(  668):   at android.view.View.dispatchKeyEvent(View.java:3173)
I/dalvikvm(  668):   at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:732)
I/dalvikvm(  668):   at
android.widget.ListView.dispatchKeyEvent(ListView.java:1839)
I/dalvikvm(  668):   at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
I/dalvikvm(  668):   at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
I/dalvikvm(  668):   at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
I/dalvikvm(  668):   at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
I/dalvikvm(  668):   at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(Pho
neWindow.java:1589)
I/dalvikvm(  668):   at
com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.j
ava:1084)
I/dalvikvm(  668):   at android.app.Dialog.dispatchKeyEvent(Dialog.java:552)
I/dalvikvm(  668):   at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWin
dow.java:1560)
I/dalvikvm(  668):   at
android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:1616)
I/dalvikvm(  668):   at
android.view.ViewRoot.deliverTrackballEvent(ViewRoot.java:1447)
I/dalvikvm(  668):   at android.view.ViewRoot.handleMessage(ViewRoot.java:1201)
I/dalvikvm(  668):   at android.os.Handler.dispatchMessage(Handler.java:88)
I/dalvikvm(  668):   at android.os.Looper.loop(Looper.java:123)
I/dalvikvm(  668):   at
android.app.ActivityThread.main(ActivityThread.java:3739)
I/dalvikvm(  668):   at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm(  668):   at java.lang.reflect.Method.invoke(Method.java:515)
I/dalvikvm(  668):   at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
I/dalvikvm(  668):   at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
I/dalvikvm(  668):   at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(  668): 
D/AndroidRuntime(  668): Shutting down VM
W/dalvikvm(  668): threadid=3: thread exiting with uncaught exception
(group=0x4000fe68)
E/AndroidRuntime(  668): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  668): java.lang.OutOfMemoryError
E/AndroidRuntime(  668):        at
java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:93)
E/AndroidRuntime(  668):        at
java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:212)
E/AndroidRuntime(  668):        at
org.connectbot.PubkeyListActivity.readRaw(PubkeyListActivity.java:177)
E/AndroidRuntime(  668):        at
org.connectbot.PubkeyListActivity$3$1.onClick(PubkeyListActivity.java:245)
E/AndroidRuntime(  668):        at
com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertControll
er.java:790)
E/AndroidRuntime(  668):        at
android.widget.AdapterView.performItemClick(AdapterView.java:283)
E/AndroidRuntime(  668):        at
android.widget.ListView.performItemClick(ListView.java:3055)
E/AndroidRuntime(  668):        at
android.widget.AbsListView.onKeyUp(AbsListView.java:1519)
E/AndroidRuntime(  668):        at
android.widget.ListView.commonKey(ListView.java:1955)
E/AndroidRuntime(  668):        at
android.widget.ListView.onKeyUp(ListView.java:1864)
E/AndroidRuntime(  668):        at
android.view.KeyEvent.dispatch(KeyEvent.java:720)
E/AndroidRuntime(  668):        at
android.view.View.dispatchKeyEvent(View.java:3173)
E/AndroidRuntime(  668):        at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:732)
E/AndroidRuntime(  668):        at
android.widget.ListView.dispatchKeyEvent(ListView.java:1839)
E/AndroidRuntime(  668):        at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
E/AndroidRuntime(  668):        at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
E/AndroidRuntime(  668):        at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
E/AndroidRuntime(  668):        at
android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:734)
E/AndroidRuntime(  668):        at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(Pho
neWindow.java:1589)
E/AndroidRuntime(  668):        at
com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.j
ava:1084)
E/AndroidRuntime(  668):        at
android.app.Dialog.dispatchKeyEvent(Dialog.java:552)
E/AndroidRuntime(  668):        at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWin
dow.java:1560)
E/AndroidRuntime(  668):        at
android.view.ViewRoot.deliverKeyEvent(ViewRoot.java:1616)
E/AndroidRuntime(  668):        at
android.view.ViewRoot.deliverTrackballEvent(ViewRoot.java:1447)
E/AndroidRuntime(  668):        at
android.view.ViewRoot.handleMessage(ViewRoot.java:1201)
E/AndroidRuntime(  668):        at
android.os.Handler.dispatchMessage(Handler.java:88)
E/AndroidRuntime(  668):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  668):        at
android.app.ActivityThread.main(ActivityThread.java:3739)
E/AndroidRuntime(  668):        at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  668):        at
java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(  668):        at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
E/AndroidRuntime(  668):        at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
E/AndroidRuntime(  668):        at dalvik.system.NativeStart.main(Native
Method)
I/dalvikvm(  668): threadid=7: reacting to signal 3
I/dalvikvm(  668): Wrote stack trace to '/data/anr/traces.txt'
I/Process (  668): Sending signal. PID: 668 SIG: 9

Original issue reported on code.google.com by jlass...@gmail.com on 17 Mar 2009 at 12:28

GoogleCodeExporter commented 8 years ago
Some sanity checks probably need to go in there. e.g., stop after x bytes if the
start of record header hasn't been found.

Original comment by kenny@the-b.org on 5 May 2009 at 10:17

GoogleCodeExporter commented 8 years ago
I put in a check to not open any file over 8 kB.

Original comment by kenny@the-b.org on 5 Jul 2009 at 2:12