diff options
| author | Jesse Hall <jessehall@google.com> | 2016-01-21 19:52:25 -0800 |
|---|---|---|
| committer | Jesse Hall <jessehall@google.com> | 2016-01-25 13:49:31 -0800 |
| commit | 26cecff368f2edba67d136ce00d27bb55634c0f1 (patch) | |
| tree | fbba524fd5737ea59c18cb51b46997ff89397c0f /opengl/tests/gl_basic/gl_basic.cpp | |
| parent | 4b62e4fd280d4f7a24f906a83ff16f5cd74bf171 (diff) | |
libvulkan: Fix dEQP-VK.api.object_management.alloc_callback_fail.instance
The loader was crashing when a std::vector::resize() operation called
the test-provided allocator, which returned failure, and then the
vector blindly started writing into the returned pointer.
Obvious in hindsight, but stdlib containers+strings + user-provided
allocation funcs implies that the loader must be built with exceptions
enabled, and must be exception-safe at least where it uses
containers/strings. We were doing neither.
This change has the minimally invasive fix, which is to (a) throw an
exception from the stdlib Allocator when the app-provided allocation
function fails, and (b) wrap every stdlib operation that might
allocate in a try..catch and turn it into a
VK_ERROR_OUT_OF_HOST_MEMORY error.
This is pretty unsatisfying and I'm not happy with the resulting
mismash of error-handling styles, with having exceptions at all in
code that was not written to be exception-safe, or with the
fine-grained try..catch. We need to decide whether to keep using parts
of stdlib that can allocate, and rewrite a lot of code to be
exception-friendly, or we need to replace the stdlib code with manual
containers and strings. Bug 26732452 filed.
Change-Id: I6f096f25a43a0e3c5f56796c2af19f114d2edac6
(cherry picked from commit ccca46db073dfadc81a68ac1533d8859ed3e109a)
Diffstat (limited to 'opengl/tests/gl_basic/gl_basic.cpp')
0 files changed, 0 insertions, 0 deletions
