diff options
author | Loren Osborn <linux_dr> | 2022-08-19 15:33:55 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-19 17:27:22 +0300 |
commit | db46251209decccadaaf9fa096822eb3c91661c1 (patch) | |
tree | 29d7e33e780b5fb96592735a075ac872338b4258 /source/blender/gpu | |
parent | a06c9b5ca8364f95bbfa6c3bedd23307e6817437 (diff) |
Fix ubsan warnings about indexing into null pointers
Ref T99382
Differential Revision: https://developer.blender.org/D15390
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/opengl/gl_index_buffer.hh | 6 |
1 files changed, 4 insertions, 2 deletions
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 |