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:44:42 -0400
commit5c4ec14b2c003031885d44a6249c0c58099672fc (patch)
tree65efe784025e1001049d3daeeba064dc7ed8eb09
parent1996da9e2f56abf969f50f5cd120a41d29984fcd (diff)
downloadb4-5c4ec14b2c003031885d44a6249c0c58099672fc.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 c1f3a1f..37d8293 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(',;')