]> git.codecow.com Git - Monocypher.git/commit
Blake2b, Poly1305: fixed undefined behaviour
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 18 Jul 2021 07:48:19 +0000 (09:48 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 18 Jul 2021 07:48:19 +0000 (09:48 +0200)
commit8680b35431eff36439c633e8e295bd1491808741
treee9c0126744b4b3d9c1a6efba3c7f09c129896c77
parent5079bb95d3a4582b5564e8bfc60f7fda8eb81cc5
Blake2b, Poly1305: fixed undefined behaviour

Caugth by TIS-CI and the latest Clang's UBSan.
Incrementing a NULL pointer, even by a NULL offset, is not permitted.
This was caused by the removal of a conditional that exited early if the
message was empty.
The fix was to move the increment inside the alignment loop.

It may be tiny bit slower, but this was the slow path already.
Users can avoid it by aligning their increments to block boundaries.
src/monocypher.c