Skip to content

Commit

Permalink
add an integer length check for selection (#142)
Browse files Browse the repository at this point in the history
add a sanity check when receiving big number as EC point

Co-authored-by: Ruiyu Zhu <[email protected]>
  • Loading branch information
RuiyuZhu and RuiyuZhu authored Dec 3, 2021
1 parent 8fdc5bb commit c1163c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions emp-tool/circuits/integer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ inline Integer::Integer(T * input, int party) {


inline Integer Integer::select(const Bit & select, const Integer & a) const{
assert(size() == a.size());
Integer res(*this);
for(size_t i = 0; i < size(); ++i)
res[i] = bits[i].select(select, a[i]);
Expand Down
4 changes: 3 additions & 1 deletion emp-tool/io/io_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "emp-tool/utils/prg.h"
#include "emp-tool/utils/group.h"
#include <memory>
#include <cassert>

namespace emp {
template<typename T>
Expand Down Expand Up @@ -41,6 +42,7 @@ class IOChannel { public:
size_t len = 0;
for(int i = 0; i < num_pts; ++i) {
recv_data(&len, 4);
assert(len <= 2048);
g->resize_scratch(len);
unsigned char * tmp = g->scratch;
recv_data(tmp, len);
Expand Down Expand Up @@ -123,4 +125,4 @@ class IOChannel { public:
}
};
}
#endif
#endif

0 comments on commit c1163c7

Please sign in to comment.