There are many cases when the gas estimator reports infinite gas. However, it doesn't necessarily mean that there is an infinite loop in your code or that your code is incorrect but just the estimator is quite restrictive when making decisions about how much gas can be consumed by the code. In particular, any backward jumps or loops in the assembly code will make it report infinite gas.
For the provided code sample array.length = 1; the compiler adds the bytecode that resets all array elements outside the new bound. For example if the array contained 10 elements and then you set its length to 1, the code will iterate over 9 elements and reset the storage slots for them. This operation involves a loop, that's why the estimator reports infinite gas estimation.
array.push() includes setting the new length of the array, so it's estimated to infinity for the same reasons.
You can read more details with links to the estimator code here How to get the cost (in gas) of the non-constant function call?