[Bf-blender-cvs] [db46251209d] master: Fix ubsan warnings about indexing into null pointers
Loren Osborn
noreply at git.blender.org
Fri Aug 19 16:27:32 CEST 2022
Commit: db46251209decccadaaf9fa096822eb3c91661c1
Author: Loren Osborn
Date: Fri Aug 19 14:33:55 2022 +0200
Branches: master
https://developer.blender.org/rBdb46251209decccadaaf9fa096822eb3c91661c1
Fix ubsan warnings about indexing into null pointers
Ref T99382
Differential Revision: https://developer.blender.org/D15390
===================================================================
M source/blender/gpu/opengl/gl_index_buffer.hh
===================================================================
diff --git a/source/blender/gpu/opengl/gl_index_buffer.hh b/source/blender/gpu/opengl/gl_index_buffer.hh
index 5a06e628315..d9bd85cefb3 100644
--- a/source/blender/gpu/opengl/gl_index_buffer.hh
+++ b/source/blender/gpu/opengl/gl_index_buffer.hh
@@ -35,9 +35,11 @@ class GLIndexBuf : public IndexBuf {
{
additional_vertex_offset += index_start_;
if (index_type_ == GPU_INDEX_U32) {
- return (GLuint *)0 + additional_vertex_offset;
+ return reinterpret_cast<void *>(static_cast<intptr_t>(additional_vertex_offset) *
+ sizeof(GLuint));
}
- return (GLushort *)0 + additional_vertex_offset;
+ return reinterpret_cast<void *>(static_cast<intptr_t>(additional_vertex_offset) *
+ sizeof(GLushort));
}
GLuint restart_index() const
More information about the Bf-blender-cvs
mailing list