Merge pull request #10917 from MarkAtwood/fix/slhdsa-base2b-shift-ub

fix: signed-shift UB in SLH-DSA base_2b digest accumulator
This commit is contained in:
David Garske
2026-08-06 11:41:50 -07:00
committed by GitHub
+4 -1
View File
@@ -1722,7 +1722,10 @@ static void slhdsakey_base_2b(const byte* x, byte b, byte outLen, word16* baseb)
int j;
int i = 0;
int bits = 0;
int total = 0;
/* total accumulates unmasked via << 8 and must be unsigned: a signed
* type overflows from the 4th consumed byte (UB). High bits are
* discarded by mask, so the output is unaffected. */
word32 total = 0;
word16 mask = (word16)((1 << b) - 1);
for (j = 0; j < outLen; j++) {