buffer: guard against integer overflow

archived-io.js-v0.10
Ben Noordhuis 2013-05-26 21:42:23 +02:00
parent 36ebff0470
commit c188a75103
1 changed files with 1 additions and 1 deletions

View File

@ -404,7 +404,7 @@ Handle<Value> ReadFloatGeneric(const Arguments& args) {
return ThrowTypeError("offset is not uint");
size_t len = static_cast<size_t>(
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");
}