HElib icon indicating copy to clipboard operation
HElib copied to clipboard

BGV scheme multiplication operation triggers a heap-buffer-overflow.

Open Wowblk opened this issue 1 year ago • 0 comments

I found a bug that causes a heap-buffer-overflow in BGV mode. The MWE is as follows:

#include <iostream>
#include <helib/helib.h>
#include <helib/binaryArith.h>
#include <helib/intraSlot.h>
int main(int argc, char* argv[])
{
long p = 2;
 long m = 4095;
 long r = 1;
 long bits = 500;
 long c = 2;
 std::vector<long> mvec = {7, 5, 9, 13};
 std::vector<long> gens = {2341, 3277, 911};
 std::vector<long> ords = {6, 4, 6};
 helib::Context context = helib::ContextBuilder<helib::BGV>()
 .m(m)
.p(p)
.r(r)
.gens(gens)
.ords(ords)
 .bits(bits)
 .c(c)
.bootstrappable(true)
.mvec(mvec)
.build();

 context.printout();
 std::cout << std::endl;
 std::cout << "Security: " << context.securityLevel() << std::endl;
 helib::SecKey secret_key(context);
 secret_key.GenSecKey();
 return 0;
}

image

Thank you for taking the time to look into this issue. Please let us know if any further details or clarification would be helpful! Best regards, wowblk

Wowblk avatar Jan 15 '25 10:01 Wowblk