From a74ef5df3df19a12366ff4fbf0a7b45dea5d19c3 Mon Sep 17 00:00:00 2001 From: devgianlu Date: Sun, 15 Dec 2024 16:02:51 +0100 Subject: [PATCH] LibCrypto: Reset cached trimmed length after `add_into_accumulator` The trimmed cache length of the `UnsignedBigInteger` was not reset after an `add_into_accumulator_without_allocation` operation because the function manipulates the words directly. This meant that if the trimmed length was calculated before this operation it would be wrong after. --- Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp b/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp index 78ac298c614..3c3302121aa 100644 --- a/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp +++ b/Libraries/LibCrypto/BigInt/Algorithms/SimpleOperations.cpp @@ -66,6 +66,8 @@ void UnsignedBigIntegerAlgorithms::add_into_accumulator_without_allocation(Unsig // Note : The accumulator couldn't add the carry directly, so we reached its end accumulator.m_words.append(last_carry_for_word); } + + accumulator.m_cached_trimmed_length = {}; } /**