zaneschepke / wgtunnel

An alternative Android client app for WireGuard VPN
https://zaneschepke.com/wgtunnel-docs
MIT License
601 stars 33 forks source link

[BUG] - Crash on 'Bad Adress' #229

Closed BBArikL closed 1 week ago

BBArikL commented 3 weeks ago

Describe the bug When enabling a VPN config with a bad address in the AllowedIPs list, the app crashes. Going through the logs, the cause is by the Android's VpnService raising a 'Bad address' error.

Stack trace:

2024-06-04T21:02:41.042833Z 0 0 VERBOSE System message= --------- beginning of crash
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message= FATAL EXCEPTION: DefaultDispatcher-worker-7
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message= Process: com.zaneschepke.wireguardautotunnel, PID: 9513
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message= java.lang.IllegalArgumentException: Bad address
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at android.net.VpnService.checkNonPrefixBytes(VpnService.java:479)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at android.net.VpnService.-$$Nest$smcheckNonPrefixBytes(Unknown Source:0)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at android.net.VpnService$Builder.addRoute(VpnService.java:636)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at com.wireguard.android.backend.GoBackend.e(Unknown Source:567)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at com.wireguard.android.backend.GoBackend.a(Unknown Source:37)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at b4.g.d(Unknown Source:326)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at b4.g.e(Unknown Source:121)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at W3.A.s(Unknown Source:142)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at J4.a.p(Unknown Source:8)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at b5.E.run(Unknown Source:114)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at b5.k0.run(Unknown Source:146)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at i5.j.run(Unknown Source:2)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  at i5.a.run(Unknown Source:91)
2024-06-04T20:38:00.000000510Z 9513 9848 ERROR AndroidRuntime: message=  Suppressed: g5.g: [l0{Cancelling}@a0e0826, Dispatchers.IO]

Smartphone:

To Reproduce Steps to reproduce the behavior:

  1. Generate a new wireguard config with one bad IP (192.168.56.1/24 here the '.1/24' should have been '.0/24')
  2. Save the config
  3. Enable VPN config
  4. See crash

Expected behavior The app should catch that error and display it to the end user like what the official Wireguard does.

tomtomclub commented 3 weeks ago

Update your app 3.4.6

https://github.com/zaneschepke/wgtunnel/releases/tag/3.4.6

BBArikL commented 3 weeks ago

Interestingly, even after 5 days, the app is not updated nor on fdroid, nor on Zach's depot: https://f-droid.org/fr/packages/com.zaneschepke.wireguardautotunnel/

I will update from the release page and update the results tomorrow.

zaneschepke commented 3 weeks ago

Interestingly, even after 5 days, the app is not updated nor on fdroid, nor on Zach's depot: https://f-droid.org/fr/packages/com.zaneschepke.wireguardautotunnel/

I will update from the release page and update the results tomorrow.

The app is updated on my personal fdroid repo here: https://github.com/zaneschepke/fdroid

Fdroid's main repo build/deployment process takes up to 1 week to update an application.

BBArikL commented 3 weeks ago

I do use your repo. 2 days ago I was sure I saw the app say 3.4.4 and the fdroid repo said 3.4.4. Checked today and it now says 3.4.6 without me updating it yesterday. Really weird situation...

All in all, the crash unfortunately remains.

share_1727188298309326414 share_1887883573306647712

goodness-from-me commented 2 weeks ago

May be connected to #144 as the crash log is the same.