Commit: 63c906e0a7e59152601435bac2d06fb1b6df6592
Author: Ankit Meel
Date:   Thu Oct 1 11:55:14 2020 +0530
Branches: master
https://developer.blender.org/rB63c906e0a7e59152601435bac2d06fb1b6df6592

Fix T81340: UBSan: addition of unsigned offset causes overflow

The warning:
runtime error: addition of unsigned offset to 0x61a0000b22d8
overflowed to 0x61a0000b22b8

Fix T81340 (partially)

Reviewed By: campbellbarton

Maniphest Tasks: T81340

Differential Revision: https://developer.blender.org/D9063

===================================================================

M       source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c 
b/source/blender/blenloader/intern/readfile.c
index ed35b5c5f8f..1072cd3686e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -284,7 +284,7 @@ typedef struct BHeadN {
   struct BHead bhead;
 } BHeadN;
 
-#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, -offsetof(BHeadN, 
bhead)))
+#define BHEADN_FROM_BHEAD(bh) ((BHeadN *)POINTER_OFFSET(bh, 
-(int)offsetof(BHeadN, bhead)))
 
 /* We could change this in the future, for now it's simplest if only data is 
delayed
  * because ID names are used in lookup tables. */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to