Fix ubsan warnings about indexing into null pointers
Ref T99382 Differential Revision: https://developer.blender.org/D15390
This commit is contained in:
parent
a06c9b5ca8
commit
db46251209
Notes:
blender-bot
2023-02-13 23:16:02 +01:00
Referenced by issue #99382, [Parent Task] Fix UBSan issues
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue