Unsafe substring parsing can cause fatal crashes on invalid responses

Open
#6,831 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Roniscend is already working on this.

Since Apr 10, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
android, kotlin
Domain
mobile

Research direction

Search the app for JSON extraction using json.indexOf('{') followed by substring, then read the response-parsing call site and its nearby tests. Check how it handles a response with no opening brace; done means invalid responses no longer cause a fatal StringIndexOutOfBoundsException.

Written by the indexing model from the issue text.

Description

Unsafe JSON extraction using substring(json.indexOf('{')) can break when responses aren’t valid JSON.If { is missing, it results in substring(-1), causing a fatal StringIndexOutOfBoundsException.

Dominant language
Kotlin
Stars
1.2k
Forks
1.4k
Avg merge
1d 4h
Merged PRs (30d)
156

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from commons-app/apps-android-commons

All issues in commons-app/apps-android-commons

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.