Bug 881742: Fix null-deref on OOM (or bad allocation size due to corrupted video) in webrtc upstream code r=jesup

This commit is contained in:
Adrian Cruceru 2015-06-18 00:06:36 -04:00
parent 40212e3fb3
commit ecc32f3948

View File

@ -43,6 +43,11 @@ int Plane::MaybeResize(int new_size) {
return 0;
scoped_ptr<uint8_t, AlignedFreeDeleter> new_buffer(static_cast<uint8_t*>(
AlignedMalloc(new_size, kBufferAlignment)));
if (!new_buffer.get()) {
return -1;
}
if (buffer_.get()) {
memcpy(new_buffer.get(), buffer_.get(), plane_size_);
}