It is not guaranteed that the function will give correct result in such an overlapping inputs. @sebbas please verify this.