garu / Clone

recursively copy Perl datatypes
7 stars 10 forks source link

Extra protection against potential infinite loop #8

Closed atoomic closed 5 years ago

atoomic commented 7 years ago

Unfortunately cannot prove that this is the source of the issue but have the feeling that the infinite loop I saw during a clone is probably coming from a lack of protection on CLONE_STORE.

If clone eq ref, its clear that this is going to loop forever.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 71d347987de7c151c08166a7cf63fee6d8664db2 on atoomic:devel/infloop into 7266910b7c8def8afe48142d36bd21f6ac2258dc on garu:master.

garu commented 7 years ago

Hi @atoomic! Thanks for the patch.

I haven't really dug around the issue, but it sounds very reasonable. I wonder if we can create a test case where clone and ref are the same, to justify the change.

atoomic commented 5 years ago

at first glance I do not think this is is possible to have ref = clone with the current code in the generic cases, but seems like IO is going to return the same object

clone = SvREFCNT_inc(ref) /* just return the ref */

so this should be possible with one IO to trigger that infinite loop