]> git.ipfire.org Git - thirdparty/coreutils.git/commit
basenc: avoid undefined behaviour in z85 processing
authorPádraig Brady <P@draigBrady.com>
Wed, 4 Mar 2020 12:24:49 +0000 (12:24 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 4 Mar 2020 12:38:27 +0000 (12:38 +0000)
commit0ea65e29dc346e9fe39db663b2ed43d7981ed266
tree6b7434f8e8ba79abdf81e7beceebf47f122ab353
parentf2034aa9bbffa766c8824d07c234ddb39620f853
basenc: avoid undefined behaviour in z85 processing

* src/basenc.c (z85_decode_ctx_init): Ensure we're working
with unsigned, as otherwise ubsan triggers with:
  src/basenc.c:767:18: runtime error: signed integer overflow:
  43 * 52200625 cannot be represented in type 'int'
(z85_encode): Likewise to avoid the usban error:
  src/basenc.c:630:26: runtime error:
  left shift of 134 by 24 places cannot be represented in type 'int'
src/basenc.c