diff options
author | Kim Alvefur <zash@zash.se> | 2020-06-04 16:11:08 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-06-04 16:11:08 +0200 |
commit | 05bfe971bf9839b1b2319b60dac65ef299ef07ef (patch) | |
tree | fd602a4d64ed0e37c495c5c2201b10765e11cff3 /spec/util_ringbuffer_spec.lua | |
parent | 73efa2f2f174f699ddb4a56320dc6fbb681e5be1 (diff) | |
download | prosody-05bfe971bf9839b1b2319b60dac65ef299ef07ef.tar.gz prosody-05bfe971bf9839b1b2319b60dac65ef299ef07ef.zip |
util.ringbuffer: Prevent creation of buffer with negative size
Previously this would have been (unsigned)-1 which is a large positive
integer.
Diffstat (limited to 'spec/util_ringbuffer_spec.lua')
-rw-r--r-- | spec/util_ringbuffer_spec.lua | 5 |
1 files changed, 5 insertions, 0 deletions
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(); |