Skip to content

IndexError: list index out of range, on empty password #64

@Tronic

Description

@Tronic
>>> zxcvbn.zxcvbn('')

zxcvbn\__init__.py in zxcvbn(password, user_inputs)
     26
     27     matches = matching.omnimatch(password, ranked_dictionaries)
---> 28     result = scoring.most_guessable_match_sequence(password, matches)
     29     result['calc_time'] = datetime.now() - start
     30

zxcvbn\scoring.py in most_guessable_match_sequence(password, matches, _exclude_additive)
    202         bruteforce_update(k)
    203
--> 204     optimal_match_sequence = unwind(n)
    205     optimal_l = len(optimal_match_sequence)
    206

zxcvbn\scoring.py in unwind(n)
    179         l = None
    180         g = float('inf')
--> 181         for candidate_l, candidate_g in optimal['g'][k].items():
    182             if candidate_g < g:
    183                 l = candidate_l

IndexError: list index out of range

As a workaround, password or ' ' works, but I gather that this should also not crash on an empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions