microsoft / DSCParser

Allows the conversion of DSC scripts into PSObject for analysis purposes
MIT License
29 stars 21 forks source link

Fix infinite loop in nested CIM instance detection #54

Closed FabienTschanz closed 1 month ago

FabienTschanz commented 1 month ago

This PR fixes an infinite loop with a reused $i variable inside of a nested loop. The current outer loop iterator $i was reassigned in the nested loop, leading to infinite executions. The inner loop variable was renamed to $j.

ricmestre commented 1 month ago

Oh the old re-use of i and j in loops, I was looking at this and wondered why the main loop (where i is used at the top) didn't break out, but had to do something else and didn't look further.

LGTM 🚀

NikCharlebois commented 1 month ago

Oh the old re-use of i and j in loops, I was looking at this and wondered why the main loop (where i is used at the top) didn't break out, but had to do something else and didn't look further.

LGTM 🚀

You'd prefer us to go with $a and $b instead? :) Thanks for looking into this folks.

FabienTschanz commented 1 month ago

Oh the old re-use of i and j in loops, I was looking at this and wondered why the main loop (where i is used at the top) didn't break out, but had to do something else and didn't look further. LGTM 🚀

You'd prefer us to go with $a and $b instead? :) Thanks for looking into this folks.

I guess one could also use x and y or some oddly named other stuff, just for the lols 😄