Skip to content

Commit

Permalink
BibIndex: infinite loop in beautify_range_list
Browse files Browse the repository at this point in the history
* Fixes infinite loop in beautify_range_list() function that
  was triggered in particular conditions.

Signed-off-by: Samuele Kaplun <[email protected]>
  • Loading branch information
kaplun committed Jul 21, 2015
1 parent 799cf16 commit 64333fe
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions modules/bibindex/lib/bibindex_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,20 +394,10 @@ def create_range_list(res):

def beautify_range_list(range_list):
"""Returns a non overlapping, maximal range list"""
ret_list = []
for new in range_list:
found = 0
for old in ret_list:
if new[0] <= old[0] <= new[1] + 1 or new[0] - 1 <= old[1] <= new[1]:
old[0] = min(old[0], new[0])
old[1] = max(old[1], new[1])
found = 1
break

if not found:
ret_list.append(new)

return ret_list
tmp_list = intbitset()
for range in range_list:
tmp_list |= intbitset(xrange(range[0], range[1]+1))
return create_range_list(tmp_list)


def truncate_index_table(index_name):
Expand Down

0 comments on commit 64333fe

Please sign in to comment.