From 4bab7af07d4707eda9246156e20610d95967679c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 4 Jun 2020 16:11:08 +0200 Subject: util.ringbuffer: Prevent creation of buffer with negative size Previously this would have been (unsigned)-1 which is a large positive integer. --- spec/util_ringbuffer_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/util_ringbuffer_spec.lua') diff --git a/spec/util_ringbuffer_spec.lua b/spec/util_ringbuffer_spec.lua index ccb5493a..9512bfd4 100644 --- a/spec/util_ringbuffer_spec.lua +++ b/spec/util_ringbuffer_spec.lua @@ -12,6 +12,11 @@ describe("util.ringbuffer", function () rb.new(0); end); end); + it("won't create a negatively sized buffer", function () + assert.has_error(function () + rb.new(-1); + end); + end); end); describe(":write", function () local b = rb.new(); -- cgit v1.2.3