Kiwix-android: Quite easy to make Kiwix crash by stressing a bit the library content search

Created on 17 Jan 2018  路  5Comments  路  Source: kiwix/kiwix-android

Here is an example of log
log.txt

bug

All 5 comments

Strongly suspect, this is the same as #240

@kelson42 Can you elaborate on how to reproduce this crash? Library content search works fine for me. I am using android version 8.0.

@RohanBh I do not remember the details and do not have a clear reprocase, but from the the log, it should be clear to know what goes wrong.

@kelson42 @mhutti1 The crash is happening precisely here at line 89.

details = details.substring(details.indexOf("_", details.indexOf("_") + 1) + 1, details.lastIndexOf("_"));

This code gives a substring from the second occurunce of _ char till the last occurence of _

For example - For the string HELLO_WORLD_IN_JAVA_8
variable details will contain IN_JAVA.

But for a string in which the second occurrence of _ is itself the last occurrence of _, the code will result in a StringIndexOutOfBoundsException with _regionLength=-1_.

How do you want me to handle it?

@RohanBh its up to you. Fix the issue anyway you feel works well and then we review it.

Was this page helpful?
0 / 5 - 0 ratings