cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Off-by-one errors in hashlib.scrypt error messages

Open 2a937e72-6d9a-4aea-b5ea-0f2721bf31dc opened this issue 4 years ago • 1 comments

BPO 46575

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-01-29.20:26:03.762>
labels = ['type-bug']
title = 'One-off errors in hashlib.scrypt error messages'
updated_at = <Date 2022-01-29.20:26:03.762>
user = 'https://bugs.python.org/ronkaminsky'

bugs.python.org fields:

activity = <Date 2022-01-29.20:26:03.762>
actor = 'ron_kaminsky'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2022-01-29.20:26:03.762>
creator = 'ron_kaminsky'
dependencies = []
files = []
hgrepos = []
issue_num = 46575
keywords = []
message_count = 1.0
messages = ['412103']
nosy_count = 1.0
nosy_names = ['ron_kaminsky']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue46575'
versions = []

There are one-off errors in upper bounds given in the error messages for hashlib.scrypt(...). MAX_INT *is* accepted (and at least for maxmem, works).

See https://github.com/python/cpython/blob/8fb36494501aad5b0c1d34311c9743c60bb9926c/Modules/_hashopenssl.c#L1375

and https://github.com/python/cpython/blob/8fb36494501aad5b0c1d34311c9743c60bb9926c/Modules/_hashopenssl.c#L1382

With thanks to everyone involved for all the fine work on Python!

As exception messages were changed, we won't backport this. Thanks for the report.

picnixz avatar Jul 14 '25 10:07 picnixz