From: Mikko Rasa Date: Sat, 4 May 2024 12:30:33 +0000 (+0300) Subject: Fix out-of-bounds accesses of vectors X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=45908a0e9c57030313304f8b1631815767ade34e;p=libs%2Fgl.git Fix out-of-bounds accesses of vectors --- diff --git a/source/backends/opengl/framebuffer_backend.cpp b/source/backends/opengl/framebuffer_backend.cpp index 247d9a4b..65a6dbc6 100644 --- a/source/backends/opengl/framebuffer_backend.cpp +++ b/source/backends/opengl/framebuffer_backend.cpp @@ -168,7 +168,7 @@ void OpenGLFramebuffer::update(unsigned mask, bool resolve) const { /* ARB_direct_state_access ties the availability of these functions to framebuffers themselves, so no further checks are needed. */ - glNamedFramebufferDrawBuffers(obj_id, color_bufs.size(), &color_bufs[0]); + glNamedFramebufferDrawBuffers(obj_id, color_bufs.size(), color_bufs.data()); glNamedFramebufferReadBuffer(obj_id, first_buffer); } else diff --git a/source/backends/vulkan/synchronizer.cpp b/source/backends/vulkan/synchronizer.cpp index 899e3e5a..466c6af1 100644 --- a/source/backends/vulkan/synchronizer.cpp +++ b/source/backends/vulkan/synchronizer.cpp @@ -61,7 +61,7 @@ void Synchronizer::split_image_mipmap(VkImage image, unsigned aspect, unsigned n access.current_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; access.pending_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - if(i->level==-2) + if(i!=image_accesses.end() && i->level==-2) i = image_accesses.erase(i); for(unsigned j=0; j