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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to