Looks like the formatting is a bit shuffled, can't get it clearly.
This is what I understand happens on the stack for a multisig P2SH tx (I ignore the 0 at the beginning for the CHECKMULTISIG bug):
Redeem Script OP_2 PubKey1 PubKey2 PubKey3 OP_3 CHECKMULTISIG
Locking Script HASH160 <20-byte hash of redeem script> EQUAL
Unlocking Script Sig1 Sig2 <redeem script>
So when I want to unlock the tx, I drop Sig1, Sig2 and <redeem script> on the stack. Then the part of the locking script, and it gives:
Sig1
Sig2
<redeem script>
HASH160
<20-byte hash of redeem script>
EQUAL
(from Andreas' book "Mastering Bitcoin"):
The two scripts are combined in two stages. First, the redeem script is checked against the locking script to make sure the hash matches.
Replacing the
<redeem script> and assuming the 20-byte
hash of redeem script is "54c557e07dde5bb6cb791c7a540e0a4796f5e97e", we get this:
OP_2 PubKey1 PubKey2 PubKey3 OP_3 CHECKMULTISIG
HASH160
54c557e07dde5bb6cb791c7a540e0a4796f5e97e
EQUAL
And then, if the redeem script hash matches, this will be executed:
<Sig1> <Sig2> OP_2 PK1 PK2 PK3 OP_3 CHECKMULTISIG
oh, the reference is on pages 151ff on the second edition of the book I mentioned.