Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some Squeak3D UB: shifting left some negative int
A reproducible case of crash provided by Stephane Rollandin gives the following warning with clang `-fsanitize=undefined`: >../../platforms/Cross/plugins/Squeak3D/b3dMain.c:1252:29: runtime error: left shift of negative value -760 >../../platforms/Cross/plugins/Squeak3D/b3dMain.c:1254:25: runtime error: left shift of negative value -751 >../../platforms/Cross/plugins/Squeak3D/b3dDraw.c:317:33: runtime error: left shift of negative value -802 >../../platforms/Cross/plugins/Squeak3D/b3dDraw.c:318:33: runtime error: left shift of negative value -802 >../../platforms/Cross/plugins/Squeak3D/b3dDraw.c:316:33: runtime error: left shift of negative value -114 >../../platforms/Cross/plugins/Squeak3D/b3dMain.c:829:61: runtime error: left shift of negative value -2 On OSX optimized VM, a crash happens in b3dMain.c, in function b3dAddBackFill at line 994 soon after those warnings By protecting the shift with (unsigned) cast, this particular crash disappear. There is still other crash happening related to bad fill list, but one thing at a time...
- Loading branch information