Bug 965945 - Prevent the parent process from running out of memory if the child process requests a giant gralloc buffer. r=bjacob
This commit is contained in:
@@ -291,6 +291,16 @@ GrallocBufferActor::Create(const gfx::IntSize& aSize,
|
|||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the requested size is too big (i.e. exceeds the commonly used max GL texture size)
|
||||||
|
// then we risk OOMing the parent process. It's better to just deny the allocation and
|
||||||
|
// kill the child process, which is what the following code does.
|
||||||
|
// TODO: actually use GL_MAX_TEXTURE_SIZE instead of hardcoding 4096
|
||||||
|
if (aSize.width > 4096 || aSize.height > 4096) {
|
||||||
|
printf_stderr("GrallocBufferActor::Create -- requested gralloc buffer is too big. Killing child instead.");
|
||||||
|
delete actor;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
sp<GraphicBuffer> buffer(new GraphicBuffer(aSize.width, aSize.height, format, usage));
|
sp<GraphicBuffer> buffer(new GraphicBuffer(aSize.width, aSize.height, format, usage));
|
||||||
if (buffer->initCheck() != OK)
|
if (buffer->initCheck() != OK)
|
||||||
return actor;
|
return actor;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<html reftest-displayport-w="800" reftest-displayport-h="6000">
|
<html reftest-displayport-w="800" reftest-displayport-h="4096">
|
||||||
<head>
|
<head>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body
|
body
|
||||||
|
|||||||
Reference in New Issue
Block a user