]> git.ipfire.org Git - thirdparty/grub.git/commit
libgcrypt/mpi: Fix possible unintended sign extension
authorDarren Kenny <darren.kenny@oracle.com>
Tue, 3 Nov 2020 16:43:37 +0000 (16:43 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:16 +0000 (15:54 +0100)
commite8814c811132a70f9b55418f7567378a34ad3883
treecff512964250f2f30db86370be3ea41aae8eb61a
parent178ac5107389f8e5b32489d743d6824a5ebf342a
libgcrypt/mpi: Fix possible unintended sign extension

The array of unsigned char gets promoted to a signed 32-bit int before
it is finally promoted to a size_t. There is the possibility that this
may result in the signed-bit being set for the intermediate signed
32-bit int. We should ensure that the promotion is to the correct type
before we bitwise-OR the values.

Fixes: CID 96697
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/lib/libgcrypt/mpi/mpicoder.c