Skip to content

lib/portage/util: fix bundled whirlpool on empty bytestring input - #832

Closed
laumann wants to merge 1 commit into
gentoo:masterfrom
laumann:fix-tests-for-bundled-whirlpool
Closed

lib/portage/util: fix bundled whirlpool on empty bytestring input#832
laumann wants to merge 1 commit into
gentoo:masterfrom
laumann:fix-tests-for-bundled-whirlpool

Conversation

@laumann

@laumann laumann commented May 19, 2022

Copy link
Copy Markdown
Contributor

The WhirlpoolAdd function did not consider zero-length input, so calls
to update(b'') would produce out-of-bounds errors. This was not covered
by any tests, because the constructor implicitly skipped the call to
update on zero-length input.

Add check for zero-length input to WhirlpoolAdd, and have the Whirlpool
constructor skip calling update() only if arg is None.

Closes: https://bugs.gentoo.org/846389
Signed-off-by: Thomas Bracht Laumann Jespersen t@laumann.xyz

@laumann

laumann commented May 19, 2022

Copy link
Copy Markdown
Contributor Author

@mgorny @thesamesam @dwfreed

Comment thread lib/portage/util/whirlpool.py Outdated
The WhirlpoolAdd function did not consider zero-length input, so calls
to update(b'') would produce out-of-bounds errors. This was not covered
by any tests, because the constructor implicitly skipped the call to
update on zero-length input.

Add check for zero-length input to WhirlpoolAdd, and have the Whirlpool
constructor skip calling update() only if arg is None.

Closes: https://bugs.gentoo.org/846389
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
@laumann
laumann force-pushed the fix-tests-for-bundled-whirlpool branch from 2e6f7f2 to cf14973 Compare May 19, 2022 13:30

@mgorny mgorny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mgorny

mgorny commented May 19, 2022

Copy link
Copy Markdown
Member

I'm rerunning the failed jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants