garydgregory commented on PR #509:
URL: 
https://github.com/apache/commons-collections/pull/509#issuecomment-2260549817

   > Hi @garydgregory:
   > 
   > > You are missing a unit test for Iterator.forEachRemaining()
   > 
   > What is the rationale to add that given that `forEachRemaining` is a 
`hasNext()`/`next()` wrapper and those are explicitly tested?
   > 
   > > Also edge cases like what if the first list, a middle list or the last 
list is empty.
   > 
   > Reasonable, added.
   > 
   > > IOW what is the expected behavior if in your example letters, numbers, 
or symbols is empty
   > 
   > Added tests to be explicit. If at least one list is empty, cartesian 
product returns no tuples.
   > 
   > > What should happen if the lists point to each other or have cycles?
   > 
   > If any of the passed iterables has cycle and thus is infinite, the 
iterator would also produce an infinite result. Here the behavior is the same 
as in nested for-loop. Could you please elaborate on the lists pointing to each 
other case as I'm not exactly sure I got you there.
   
   If the API allows an infinite loop, this is what will happen: Someone will 
send an email to our security mailing list saying they found a critical DOS 
vulnerability and ask for a CVE to be credited to them; time will be taken 
analyzing, deciding what to do and replying to the poster. This is why we've 
fixed these types of bugs overtime and added tests like 
   - `HashCodeBuilderTest.testReflectionObjectCycle()`
   - `ToStringBuilderTest.testSelfInstanceTwoVarsReflectionObjectCycle()`
   - `ToStringBuilderTest.testSelfInstanceVarReflectionObjectCycle()`
   - `ToStringBuilderTest.testSimpleReflectionObjectCycle()`
   - `StrSubstitutorTest.testCyclicReplacement()`
   - `ToStringBuilderTest.testReflectionArrayAndObjectCycle()`
   - `ToStringBuilderTest.testReflectionArrayArrayCycle()`
   - ...
   
   And yes, there are probably more of these types of bugs lurking around, so 
let's not add new ones ;-)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to