mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-08 01:10:43 +02:00
Avoid dereference-of-casted-pointer
This commit is contained in:
@ -1099,7 +1099,7 @@ public:
|
||||
// Serialize the script
|
||||
if (nInput != nIn)
|
||||
// Blank out other inputs' signatures
|
||||
::Serialize(s, CScriptBase());
|
||||
::Serialize(s, CScript());
|
||||
else
|
||||
SerializeScriptCode(s);
|
||||
// Serialize the nSequence
|
||||
@ -1207,7 +1207,7 @@ uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsig
|
||||
// The prevout may already be contained in hashPrevout, and the nSequence
|
||||
// may already be contain in hashSequence.
|
||||
ss << txTo.vin[nIn].prevout;
|
||||
ss << static_cast<const CScriptBase&>(scriptCode);
|
||||
ss << scriptCode;
|
||||
ss << amount;
|
||||
ss << txTo.vin[nIn].nSequence;
|
||||
// Outputs (none/one/all, depending on flags)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "crypto/common.h"
|
||||
#include "prevector.h"
|
||||
#include "serialize.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <climits>
|
||||
@ -404,6 +405,13 @@ public:
|
||||
CScript(std::vector<unsigned char>::const_iterator pbegin, std::vector<unsigned char>::const_iterator pend) : CScriptBase(pbegin, pend) { }
|
||||
CScript(const unsigned char* pbegin, const unsigned char* pend) : CScriptBase(pbegin, pend) { }
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(static_cast<CScriptBase&>(*this));
|
||||
}
|
||||
|
||||
CScript& operator+=(const CScript& b)
|
||||
{
|
||||
insert(end(), b.begin(), b.end());
|
||||
|
Reference in New Issue
Block a user