From 60890019bed39ba96cd77d130a1c96f0273951f6 Mon Sep 17 00:00:00 2001 From: schwarz Date: Thu, 19 Dec 2019 13:44:25 +0100 Subject: [PATCH] Checks wrong values vor param belowLVL --- src/recryption.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/recryption.cpp b/src/recryption.cpp index adee229f2..f8a968248 100644 --- a/src/recryption.cpp +++ b/src/recryption.cpp @@ -713,6 +713,7 @@ void packedRecrypt(const CtPtrs& cPtrs, const std::vector& unpackConsts, const EncryptedArray& ea) { + if(cPtrs.size() == 0) return; // if there is no entry the next line will throw a exception. FHEPubKey& pKey = (FHEPubKey&)cPtrs[0]->getPubKey(); // Allocate temporary ciphertexts for the recryption @@ -733,6 +734,9 @@ void packedRecrypt(const CtPtrs& array, const std::vector& unpackConsts, const EncryptedArray& ea, long belowLvl) { + if(belowLvl == LONG_MAX) //default Value + belowLvl /= ea.getContext().BPL(); + assertTrue(belowLvl <= (LONG_MAX / ea.getContext().BPL()),"Level to high overflow of Type LONG"); std::vector v; for (long i=0; iisEmpty() @@ -744,6 +748,9 @@ void packedRecrypt(const CtPtrMat& m, const std::vector& unpackConsts, const EncryptedArray& ea, long belowLvl) { + if(belowLvl == LONG_MAX) //default Value + belowLvl /= ea.getContext().BPL(); + assertTrue(belowLvl <= (LONG_MAX / ea.getContext().BPL()),"Level to high overflow of Type LONG"); std::vector v; for (long i=0; i