summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-12 10:44:42 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-12 10:45:43 -0400
commitad3d5a8d4e90915bf16fc4b07995963f34e40d0a (patch)
tree117b9966b79bfd2ad3b5dd75659db133bd45a994
parent23b8948263478946a08095e4b5e4629e926dd4d9 (diff)
downloadb4-ad3d5a8d4e90915bf16fc4b07995963f34e40d0a.tar.gz
Fix crash with unbalanced [] in subject
Don't crash if there is no matching ] in the subject. The culprit: https://lore.kernel.org/lkml/20200612142621.GA8009@lenoir Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 641cc70..c85b85e 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1382,6 +1382,8 @@ class LoreSubject:
# Find all [foo] in the title
while subject.find('[') == 0:
matches = re.search(r'^\[([^\]]*)\]', subject)
+ if not matches:
+ break
for chunk in matches.groups()[0].split():
# Remove any trailing commas or semicolons
chunk = chunk.strip(',;')