potential crash on inforeader
authorNiki Roo <niki@nikiroo.be>
Mon, 27 Apr 2020 16:08:14 +0000 (18:08 +0200)
committerNiki Roo <niki@nikiroo.be>
Mon, 27 Apr 2020 16:08:14 +0000 (18:08 +0200)
supported/InfoReader.java

index 1a00ef25f6102d8928f2a1c213f2afe66dc4c01e..405b28fb4197be856192e3b8ad31a219f4636cc5 100644 (file)
@@ -259,14 +259,17 @@ public class InfoReader {
                        String value = getLine(in, key, 0);
                        if (value != null && !value.isEmpty()) {
                                value = value.trim().substring(key.length() - 1).trim();
-                               if (value.startsWith("'") && value.endsWith("'")
-                                               || value.startsWith("\"") && value.endsWith("\"")) {
+                               if (value.length() > 1 && //
+                                               (value.startsWith("'") && value.endsWith("'")
+                                                               || value.startsWith("\"")
+                                                                               && value.endsWith("\""))) {
                                        value = value.substring(1, value.length() - 1).trim();
                                }
 
                                // Some old files ended up with TITLE="'xxxxx'"
-                               if ("TITLE".equals(key)) {
-                                       if (value.startsWith("'") && value.endsWith("'")) {
+                               if ("^TITLE=".equals(key)) {
+                                       if (value.startsWith("'") && value.endsWith("'")
+                                                       && value.length() > 1) {
                                                value = value.substring(1, value.length() - 1).trim();
                                        }
                                }