зеркало из https://github.com/mozilla/gecko-dev.git
Bug 814407 - check for null buffer data in readpixels (should never happen, but apparently does) - r=jgilbert
This commit is contained in:
Родитель
c70efb7365
Коммит
37a26121ee
|
@ -3156,7 +3156,6 @@ WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width,
|
||||||
WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
|
WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
|
||||||
WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
|
WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
|
||||||
|
|
||||||
void* data = pixels->Data();
|
|
||||||
uint32_t dataByteLen = JS_GetTypedArrayByteLength(pixels->Obj());
|
uint32_t dataByteLen = JS_GetTypedArrayByteLength(pixels->Obj());
|
||||||
int dataType = JS_GetTypedArrayType(pixels->Obj());
|
int dataType = JS_GetTypedArrayType(pixels->Obj());
|
||||||
|
|
||||||
|
@ -3215,6 +3214,12 @@ WebGLContext::ReadPixels(WebGLint x, WebGLint y, WebGLsizei width,
|
||||||
if (checked_neededByteLength.value() > dataByteLen)
|
if (checked_neededByteLength.value() > dataByteLen)
|
||||||
return ErrorInvalidOperation("readPixels: buffer too small");
|
return ErrorInvalidOperation("readPixels: buffer too small");
|
||||||
|
|
||||||
|
void* data = pixels->Data();
|
||||||
|
if (!data) {
|
||||||
|
ErrorOutOfMemory("readPixels: buffer storage is null. Did we run out of memory?");
|
||||||
|
return rv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
|
|
||||||
// Check the format and type params to assure they are an acceptable pair (as per spec)
|
// Check the format and type params to assure they are an acceptable pair (as per spec)
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case LOCAL_GL_RGBA: {
|
case LOCAL_GL_RGBA: {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче