From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1AD4D4765E0 for ; Wed, 23 Dec 2020 19:50:19 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) From: Sergey Ostanevich In-Reply-To: <7f5108768b70c9ffd2561f89c4974379085921e4.1608142899.git.skaplun@tarantool.org> Date: Wed, 23 Dec 2020 19:50:17 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <2904C812-0AD8-4E70-BCDA-17FCF20F990F@tarantool.org> References: <7f5108768b70c9ffd2561f89c4974379085921e4.1608142899.git.skaplun@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH luajit v1 02/11] utils: introduce leb128 reader and writer List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! I have only one comment after Igor=E2=80=99s = review put the =E2=80=98buffer overflow=E2=80=99 as a =E2=80=98No bounds checks = for the buffer' Regards, Sergos > +/* > +** Writes a value from an unsigned 64-bit input to a buffer of bytes. > +** Buffer overflow is not checked. Returns number of bytes written. > +*/ > +size_t write_uleb128(uint8_t *buffer, uint64_t value); > + > +/* > +** Writes a value from an signed 64-bit input to a buffer of bytes. > +** Buffer overflow is not checked. Returns number of bytes written. > +*/ > +size_t write_leb128(uint8_t *buffer, int64_t value); > + > +/* > +** Reads a value from a buffer of bytes to a uint64_t output. > +** Buffer overflow is not checked. Returns number of bytes read. > +*/ > +size_t read_uleb128(uint64_t *out, const uint8_t *buffer); > + > +/* > +** Reads a value from a buffer of bytes to a int64_t output. > +** Buffer overflow is not checked. Returns number of bytes read. > +*/ > +size_t read_leb128(int64_t *out, const uint8_t *buffer); > + > +/* > +** Reads a value from a buffer of bytes to a uint64_t output. = Consumes no more > +** than n bytes. Buffer overflow is not checked. Returns number of = bytes read. > +** If more than n bytes is about to be consumed, returns 0 without = touching out. > +*/ > +size_t read_uleb128_n(uint64_t *out, const uint8_t *buffer, size_t = n); > + > +/* > +** Reads a value from a buffer of bytes to a int64_t output. Consumes = no more > +** than n bytes. Buffer overflow is not checked. Returns number of = bytes read. > +** If more than n bytes is about to be consumed, returns 0 without = touching out. > +*/ > +size_t read_leb128_n(int64_t *out, const uint8_t *buffer, size_t n); > + > +#endif > --=20 > 2.28.0 >=20