From 822df85640358cedffc6c6b1eeb2abe266a3dcad Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 26 Sep 2018 13:55:05 +0900 Subject: [PATCH] fix boundary check --- include/mcl/vint.hpp | 2 +- test/bench.hpp | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/include/mcl/vint.hpp b/include/mcl/vint.hpp index 242e27b..32a51bb 100644 --- a/include/mcl/vint.hpp +++ b/include/mcl/vint.hpp @@ -1182,7 +1182,7 @@ public: bool b; save(&b, os, base); const size_t n = os.getPos(); - if (!b || n == bufSize - 1) return 0; + if (!b || n == bufSize) return 0; buf[n] = '\0'; return n; } diff --git a/test/bench.hpp b/test/bench.hpp index 494042b..19c04b6 100644 --- a/test/bench.hpp +++ b/test/bench.hpp @@ -14,18 +14,13 @@ void testBench(const G1& P, const G2& Q) x.setHashOf("abc"); y.setHashOf("xyz"); #if 1 - mpz_class z = 3; mpz_class a = x.getMpz(); CYBOZU_BENCH_C("G1::mulCT ", C, G1::mulCT, Pa, P, a); -// CYBOZU_BENCH_C("G1::mulCTsmall", C, G1::mulCT, Pa, P, z); CYBOZU_BENCH_C("G1::mul ", C, G1::mul, Pa, Pa, a); -// CYBOZU_BENCH_C("G1::mulsmall ", C, G1::mul, Pa, Pa, z); CYBOZU_BENCH_C("G1::add ", C, G1::add, Pa, Pa, P); CYBOZU_BENCH_C("G1::dbl ", C, G1::dbl, Pa, Pa); CYBOZU_BENCH_C("G2::mulCT ", C, G2::mulCT, Qa, Q, a); -// CYBOZU_BENCH_C("G2::mulCTsmall", C, G2::mulCT, Qa, Q, z); CYBOZU_BENCH_C("G2::mul ", C, G2::mul, Qa, Qa, a); -// CYBOZU_BENCH_C("G2::mulsmall ", C, G2::mul, Qa, Qa, z); CYBOZU_BENCH_C("G2::add ", C, G2::add, Qa, Qa, Q); CYBOZU_BENCH_C("G2::dbl ", C, G2::dbl, Qa, Qa); CYBOZU_BENCH_C("GT::pow ", C, GT::pow, e1, e1, a);