Skip to content

Commit

Permalink
Merge pull request #59 from jayvdb/bibparse-hang
Browse files Browse the repository at this point in the history
bibparse hangs on unexpected end of file
  • Loading branch information
yarikoptic committed Feb 9, 2020
2 parents bce6754 + 1ac1a7b commit 3d1823d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions citeproc/source/bibtex/bibparse.py
Expand Up @@ -120,6 +120,8 @@ def _parse_key(self, file):
while char != ',':
key += char
char = file.read(1)
if not char:
raise ValueError('End of file while parsing key')
return key.strip().lower()

def _parse_name(self, file):
Expand Down Expand Up @@ -155,6 +157,8 @@ def _parse_string(self, file, opening_character):
depth = 0
while True:
char = file.read(1)
if not char:
raise ValueError('End of file while parsing string value')
if char == '{':
depth += 1
elif depth == 0 and char == closing_character:
Expand Down

0 comments on commit 3d1823d

Please sign in to comment.