From 3b0271f56013234cf4d967808627cd350f624f38 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 19 Aug 2018 21:56:33 +0100 Subject: util.stanza + tests: Bail out of loop if we are iterating too far, fixes #981 --- spec/util_stanza_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec') diff --git a/spec/util_stanza_spec.lua b/spec/util_stanza_spec.lua index aabeeadc..383beae3 100644 --- a/spec/util_stanza_spec.lua +++ b/spec/util_stanza_spec.lua @@ -327,5 +327,12 @@ describe("util.stanza", function() end); assert.equal(3, #s.tags); end); + it("errors on invalid data - #981", function () + local s = st.message({}, "Hello"); + s.tags[1] = st.clone(s.tags[1]); + assert.has_error_match(function () + s:maptags(function () end); + end, "Invalid stanza"); + end); end); end); -- cgit v1.2.3