ConnectSDK / Connect-SDK-Android-Core

Core source code for the Android Connect SDK project
Apache License 2.0
114 stars 79 forks source link

SSDPDiscoveryProvider crashes with StringIndexOutOfBoundsException #9

Closed softvision-ionutgavris closed 9 years ago

softvision-ionutgavris commented 9 years ago

We see a lot of crashes generated by SSDPDiscoveryProvider from our app that is published on the Google Play store.

java.lang.StringIndexOutOfBoundsException: length=1024; regionStart=0; regionLength=-1 at java.lang.String.startEndAndLength(String.java:588) at java.lang.String.substring(String.java:1475) at com.connectsdk.core.upnp.ssdp.SSDP$ParsedDatagram.() at com.connectsdk.core.upnp.ssdp.SSDP.convertDatagram() at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$4.run() at java.lang.Thread.run(Thread.java:841)

We are currently using the 1.3 library version.

Please check and make sure these are fixed in newer library versions and if possible to provide a patch for the 1.3 lib.

PS. While previous lib versions like 1.2.x also generated crashes because of SSDPDiscoveryProvider.sendSearch() Timers, these appear to be fixed in 1.3.

oleksii-frolov commented 9 years ago

We did a refactoring in the current version for SSDP, so the classes were changed for that part. We also have tests coverage for SSDPPacket class and I don't see any errors in the latest version

khk624 commented 9 years ago

I think this has been resolved in https://github.com/ConnectSDK/Connect-SDK-Android-Core/commit/a3b36bab403b0d524642e9d2b886a5caa9f47acd and https://github.com/ConnectSDK/Connect-SDK-Android-Core/commit/9e65252d6fa4bf0a77be1f988e3d68273b3f47c8.

The cause was sometimes packet has only LF without CR for the end-of-line marker. This might be the same issue as yours.

I'm going to close this ticket.