check that parity and data buffers are < 65536

This commit is contained in:
Dmitriy Ryajov 2022-03-28 15:57:43 -06:00
parent 93a3bbcde2
commit d85bb31062
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4

View File

@ -73,7 +73,7 @@ func encode*(
let
res = leoEncode(
self.bufSize.cuint,
self.bufSize.culonglong,
self.buffers.cuint,
self.parity.cuint,
self.workBufferCount.cuint,
@ -144,7 +144,7 @@ func decode*(
let
res = leo_decode(
self.bufSize.cuint,
self.bufSize.culonglong,
self.buffers.cuint,
self.parity.cuint,
self.decodeBufferCount.cuint,
@ -206,6 +206,9 @@ proc init[TT: Leo](
if parity > buffers:
return err("number of parity buffers cannot exceed number of data buffers!")
if buffers + parity > 65536:
return err("number of parity and data buffers cannot exceed 65536!")
once:
# First, attempt to init the leopard library,
# this happens only once for all threads and