The underlying issue was discovered by an assert added in a80053322b765eec939 by a test case provided by @mstorsjo.