“SIGHASH_SINGLE bug”
It is not a bug, that is the only way SIGHASH_SINGLE can be defined. That sighash flag says you have to sign output at the same index as your input
but in Bitcoin protocol there is no rule saying the transaction has to have same number of inputs and outputs meaning there may not be any output at the same index but you still have to sign something if that sighash is used, therefore a fixed value is used.