]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix out-of-bounds accesses of vectors
authorMikko Rasa <tdb@tdb.fi>
Sat, 4 May 2024 12:30:33 +0000 (15:30 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 4 May 2024 16:31:42 +0000 (19:31 +0300)
source/backends/opengl/framebuffer_backend.cpp
source/backends/vulkan/synchronizer.cpp

index 247d9a4b59792276c394bf379b33b3ce2eafcddc..65a6dbc67c59c8823657eaa0d24ed1da86648447 100644 (file)
@@ -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
index 899e3e5a22fa0c9820e1c575912720e8887f347d..466c6af1f254915d0a326cfceb940dbea55089d1 100644 (file)
@@ -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<n_levels; ++i, ++j)