Page MenuHome

Fix T81340: UBSan: applying offset to nullptr.
AbandonedPublic

Authored by Ankit Meel (ankitm) on Oct 1 2020, 1:24 AM.

Details

Summary

Removing the (const GLubyte *)0 fixed the UBSan warning [1], but
created a new one [2]. So make offset wide enough to hold 64 bit
pointer.

[1] gl_vertex_array.cc:65:57: runtime error: applying non-zero offset
32 to null pointer
[2] Cast to 'const unsigned int *' from smaller integer
type 'unsigned int'

Fix T81340 (partially)

Diff Detail

Repository
rB Blender
Branch
ubvertarray (branched from master)
Build Status
Buildable 10503
Build 10503: arc lint + arc unit

Event Timeline

Ankit Meel (ankitm) requested review of this revision.Oct 1 2020, 1:24 AM
Ankit Meel (ankitm) created this revision.

Applied alternate patch rBa4e14c3bfdb7: Cleanup: avoid applying offset to null pointer as there is no need to assume the system is 64bit.

Instead cast to intptr_t and then to a pointer.

source/blender/gpu/opengl/gl_vertex_array.cc
51

Why is this needed?

source/blender/gpu/opengl/gl_vertex_array.cc
51

To silence the second warning as mentioned above in the box.