buffer: guard against integer overflow
This commit is contained in:
parent
36ebff0470
commit
c188a75103
@ -404,7 +404,7 @@ Handle<Value> ReadFloatGeneric(const Arguments& args) {
|
|||||||
return ThrowTypeError("offset is not uint");
|
return ThrowTypeError("offset is not uint");
|
||||||
size_t len = static_cast<size_t>(
|
size_t len = static_cast<size_t>(
|
||||||
args.This()->GetIndexedPropertiesExternalArrayDataLength());
|
args.This()->GetIndexedPropertiesExternalArrayDataLength());
|
||||||
if (offset + sizeof(T) > len)
|
if (offset + sizeof(T) > len || offset + sizeof(T) < offset)
|
||||||
return ThrowRangeError("Trying to read beyond buffer length");
|
return ThrowRangeError("Trying to read beyond buffer length");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user