-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
Issue description
When trying to play a faulty remote VOD asset, our app crashed due to an ArrayIndexOutOfBoundsException in WebvttParserUtil. Specifically, at the return line of the parseTimestampUs() method:
public static long parseTimestampUs(String timestamp) throws NumberFormatException {
long value = 0;
String[] parts = timestamp.split("\\.", 2);
String[] subparts = parts[0].split(":");
for (String subpart : subparts) {
value = value * 60 + Long.parseLong(subpart);
}
return (value * 1000 + Long.parseLong(parts[1])) * 1000;
}
and even more specifically, due to trying to access parts[1], while the length of parts[] is 1 in this case.
Of course, on our side we can fix it by modifying the faulty asset, but as it was appropriately put in issue #3130 ExoPlayer "should never crash when encountering malformed media", so I think a length check for the parts array would be a good idea.
Reproduction steps
Play an asset with a wrong timestamp.
Link to test content
The asset is not available outside our network.
Version of ExoPlayer being used
2.5.3
Device(s) and version(s) of Android being used
Xiaomi MiBox, Android TV 6.0.1
A full bug report captured from the device
--------- beginning of crash
10-16 14:29:47.478 E/AndroidRuntime(23348): FATAL EXCEPTION: Thread-677
10-16 14:29:47.478 E/AndroidRuntime(23348): Process: [packagename], PID: 23348
10-16 14:29:47.478 E/AndroidRuntime(23348): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.webvtt.WebvttParserUtil.parseTimestampUs(WebvttParserUtil.java:61)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.webvtt.WebvttCueParser.parseCue(WebvttCueParser.java:224)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.webvtt.WebvttCueParser.parseCue(WebvttCueParser.java:98)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:83)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.webvtt.WebvttDecoder.decode(WebvttDecoder.java:30)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:70)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.text.SimpleSubtitleDecoder.decode(SimpleSubtitleDecoder.java:25)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.decoder.SimpleDecoder.decode(SimpleDecoder.java:222)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.decoder.SimpleDecoder.run(SimpleDecoder.java:188)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.decoder.SimpleDecoder.access$000(SimpleDecoder.java:25)
10-16 14:29:47.478 E/AndroidRuntime(23348): at com.google.android.exoplayer2.decoder.SimpleDecoder$1.run(SimpleDecoder.java:66)
10-16 14:29:47.491 W/ActivityManager( 3841): Force finishing activity [packagename]/.[activity]