script: return malformed script if returned pushDataOut out of range
This commit is contained in:
parent
d904e4424c
commit
b6622b4cff
1 changed files with 4 additions and 1 deletions
|
@ -41,8 +41,11 @@ Script.fromBuffer = function (buffer) {
|
||||||
|
|
||||||
// did reading a pushDataInt fail? return non-chunked script
|
// did reading a pushDataInt fail? return non-chunked script
|
||||||
if (d === null) return new Script(buffer, [])
|
if (d === null) return new Script(buffer, [])
|
||||||
|
|
||||||
i += d.size
|
i += d.size
|
||||||
|
|
||||||
|
// attempt to read too much data?
|
||||||
|
if (i + d.number > buffer.length) return new Script(buffer, [])
|
||||||
|
|
||||||
var data = buffer.slice(i, i + d.number)
|
var data = buffer.slice(i, i + d.number)
|
||||||
i += d.number
|
i += d.number
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue