From d85bb310628208df3a037f8dbb2405761dbbda56 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 28 Mar 2022 15:57:43 -0600 Subject: [PATCH] check that parity and data buffers are < 65536 --- leopard/leopard.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/leopard/leopard.nim b/leopard/leopard.nim index 6e60bef..4bac400 100644 --- a/leopard/leopard.nim +++ b/leopard/leopard.nim @@ -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