From 25fcb7bef83b8b11463e726b8ae5d0cfee8091b3 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 20 May 2017 01:42:20 -0400 Subject: [PATCH] Clear coverity finding CHECKED_RETURN (CID 147833) --- gf2n.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gf2n.cpp b/gf2n.cpp index e5e11207..a1d24ff3 100644 --- a/gf2n.cpp +++ b/gf2n.cpp @@ -155,12 +155,16 @@ void PolynomialMod2::Encode(byte *output, size_t outputLen) const void PolynomialMod2::Decode(BufferedTransformation &bt, size_t inputLen) { + CRYPTOPP_ASSERT(bt.MaxRetrievable() >= inputLen); + if (bt.MaxRetrievable() < inputLen) + throw InvalidArgument("PolynomialMod2: input length is too small"); + reg.CleanNew(BytesToWords(inputLen)); for (size_t i=inputLen; i > 0; i--) { byte b; - bt.Get(b); + (void)bt.Get(b); reg[(i-1)/WORD_SIZE] |= word(b) << ((i-1)%WORD_SIZE)*8; } }