diff options
author | Stephan Unverwerth <s.unverwerth@serenityos.org> | 2022-12-21 16:01:34 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-26 09:39:20 +0100 |
commit | 0993aba32165e0ee4e8db40528c148909b76553e (patch) | |
tree | 3d716bd076a772b4cbb2dc91724fbfd8d414f509 /Userland/Libraries/LibVirtGPU | |
parent | 140338670a1ee3ad0e159d0e47e37bca7ab2dbf9 (diff) | |
download | serenity-0993aba32165e0ee4e8db40528c148909b76553e.zip |
LibVirtGPU: Add length verification to append_create_shader()
Diffstat (limited to 'Userland/Libraries/LibVirtGPU')
-rw-r--r-- | Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp index 8db8707dba..887a653ebf 100644 --- a/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp +++ b/Userland/Libraries/LibVirtGPU/CommandBufferBuilder.cpp @@ -273,6 +273,8 @@ void CommandBufferBuilder::append_set_constant_buffer(Vector<float> const& const void CommandBufferBuilder::append_create_shader(Protocol::ObjectHandle handle, Gallium::ShaderType shader_type, StringView shader_data) { size_t shader_len = shader_data.length() + 1; // Need to remember to copy null terminator as well if needed + VERIFY(shader_len <= NumericLimits<u32>::max()); + CommandBuilder builder(m_buffer, Protocol::VirGLCommand::CREATE_OBJECT, Protocol::ObjectType::SHADER); builder.appendu32(handle.value()); // VIRGL_OBJ_CREATE_HANDLE builder.appendu32(to_underlying(shader_type)); |