I tested with the random seed mentioned in the PR description (but this does not cause the bug on my system)
`src/test/test_bitcoin --random=99999`
I was able to reproduce the error with seed `874756305`. This fails before this commit, and succeeded after:
```
src/test/test_bitcoin --log_level=test_suite --run_test=transaction_tests,script_p2sh_tests --random=874756305
```