Environment Info:
APK: android:versionCode="32" android:versionName="1.2.7"
AndroidOS: Version = “6.0.1”
Description information:
We find that mobile apps are prone to crashes due to a network issue, mainly because successful network API calls return unexpected or no data.
And we found that when this app's network returned data is null or some fields are null (JSON format), or is empty, the app has crashed.
How do we test the APP?
We use the fuzzing method to simulate the network response data. For example, when the app receives network API response data from server or network, we will replace it with 404, null and random data.
#A very simple example:
normal data :Value=”hello” -----fuzzing-----> simulated data :Value=null or network request fails(404、503) or Value=”heee”(random data) or Value=""(empty) , etc.
java.lang.NumberFormatException: Invalid int: "null"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parse(Integer.java:410)
at java.lang.Integer.parseInt(Integer.java:367)
at java.lang.Integer.parseInt(Integer.java:334)
at de.jkliemann.parkendd.Parser.meta(Parser.java:41)
at de.jkliemann.parkendd.MainActivity.onLoaderFinished(MainActivity.java:132)
at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:112)
at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:22)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.jkliemann.parkendd/de.jkliemann.parkendd.ForecastActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2443)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2503)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference
at de.jkliemann.parkendd.ForecastActivity.loadDate(ForecastActivity.java:103)
at de.jkliemann.parkendd.ForecastActivity.onCreate(ForecastActivity.java:86)
at android.app.Activity.performCreate(Activity.java:6279)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2396)
... 9 more
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference
at de.jkliemann.parkendd.ForecastActivity.loadDate(ForecastActivity.java:103)
at de.jkliemann.parkendd.ForecastActivity.onCreate(ForecastActivity.java:86)
at android.app.Activity.performCreate(Activity.java:6279)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2396)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2503)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.util.Date.getTime()' on a null object reference
at java.util.Calendar.setTime(Calendar.java:1197)
at java.text.SimpleDateFormat.formatImpl(SimpleDateFormat.java:527)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:829)
at java.text.DateFormat.format(DateFormat.java:314)
at de.jkliemann.parkendd.MainActivity.onLoaderFinished(MainActivity.java:150)
at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:112)
at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:22)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Finally:
The cause of the program crash may be that the network response data is not handled properly in the code. Such as, developers probably ignore the fact that data is null.
Although this kind of collapse is relatively rare, it is also worthy of attention.
If you have confirmed or fixed this problem, please give me a reply, thank you!
Environment Info: APK: android:versionCode="32" android:versionName="1.2.7" AndroidOS: Version = “6.0.1”
Description information: We find that mobile apps are prone to crashes due to a network issue, mainly because successful network API calls return unexpected or no data. And we found that when this app's network returned data is null or some fields are null (JSON format), or is empty, the app has crashed.
How do we test the APP? We use the fuzzing method to simulate the network response data. For example, when the app receives network API response data from server or network, we will replace it with 404, null and random data. #A very simple example: normal data :Value=”hello” -----fuzzing-----> simulated data :Value=null or network request fails(404、503) or Value=”heee”(random data) or Value=""(empty) , etc.
crash information: Crash One:crashActivity=de.jkliemann.parkendd.MainActivity
java.lang.NumberFormatException: Invalid int: "null" at java.lang.Integer.invalidInt(Integer.java:138) at java.lang.Integer.parse(Integer.java:410) at java.lang.Integer.parseInt(Integer.java:367) at java.lang.Integer.parseInt(Integer.java:334) at de.jkliemann.parkendd.Parser.meta(Parser.java:41) at de.jkliemann.parkendd.MainActivity.onLoaderFinished(MainActivity.java:132) at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:112) at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:22) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Crash Two:crashActivity=de.jkliemann.parkendd.ForecastActivity
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.jkliemann.parkendd/de.jkliemann.parkendd.ForecastActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2443) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2503) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference at de.jkliemann.parkendd.ForecastActivity.loadDate(ForecastActivity.java:103) at de.jkliemann.parkendd.ForecastActivity.onCreate(ForecastActivity.java:86) at android.app.Activity.performCreate(Activity.java:6279) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2396) ... 9 more java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference at de.jkliemann.parkendd.ForecastActivity.loadDate(ForecastActivity.java:103) at de.jkliemann.parkendd.ForecastActivity.onCreate(ForecastActivity.java:86) at android.app.Activity.performCreate(Activity.java:6279) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2396) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2503) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Crash Three:crashActivity=de.jkliemann.parkendd.MainActivity
java.lang.NullPointerException: Attempt to invoke virtual method 'long java.util.Date.getTime()' on a null object reference at java.util.Calendar.setTime(Calendar.java:1197) at java.text.SimpleDateFormat.formatImpl(SimpleDateFormat.java:527) at java.text.SimpleDateFormat.format(SimpleDateFormat.java:829) at java.text.DateFormat.format(DateFormat.java:314) at de.jkliemann.parkendd.MainActivity.onLoaderFinished(MainActivity.java:150) at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:112) at de.jkliemann.parkendd.Loader.onPostExecute(Loader.java:22) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5539) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
Finally: The cause of the program crash may be that the network response data is not handled properly in the code. Such as, developers probably ignore the fact that data is null. Although this kind of collapse is relatively rare, it is also worthy of attention. If you have confirmed or fixed this problem, please give me a reply, thank you!