Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when adding physics nodes with collision shapes #47436

Closed
Tracked by #45334
qarmin opened this issue Mar 28, 2021 · 2 comments
Closed
Tracked by #45334

Crash when adding physics nodes with collision shapes #47436

qarmin opened this issue Mar 28, 2021 · 2 comments

Comments

@qarmin
Copy link
Contributor

qarmin commented Mar 28, 2021

Godot version:
3.3.rc.custom_build. ed1f5c2

OS
Ubuntu 20.04 - Ubuntu 3.36 X11

Issue description:
When I add in one frame nodes(KinematicBody, StaticBody etc.) with collision shapes, then in next frame Godot crashes

Few address sanitizer logs:

==193157==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffbb8541d0 at pc 0x000004449e10 bp 0x7fffbb853e60 sp 0x7fffbb853e50
READ of size 4 at 0x7fffbb8541d0 thread T0
    #0 0x4449e0f in Transform2D::tdoty(Vector2 const&) const core/math/transform_2d.h:52
    #1 0x444ace4 in Transform2D::xform(Vector2 const&) const core/math/transform_2d.h:155
    #2 0x10c393fd in CollisionSolver2DSW::solve_static_line(Shape2DSW const*, Transform2D const&, Shape2DSW const*, Transform2D const&, void (*)(Vector2 const&, Vector2 const&, void*), void*, bool) servers/physics_2d/collision_solver_2d_sw.cpp:56
    #3 0x10c3dbb5 in CollisionSolver2DSW::solve(Shape2DSW const*, Transform2D const&, Vector2 const&, Shape2DSW const*, Transform2D const&, Vector2 const&, void (*)(Vector2 const&, Vector2 const&, void*), void*, Vector2*, float, float) servers/physics_2d/collision_solver_2d_sw.cpp:222
    #4 0x10b714d2 in AreaPair2DSW::setup(float) servers/physics_2d/area_pair_2d_sw.cpp:40
    #5 0x102b7d87 in Step2DSW::_setup_island(Constraint2DSW*, float) servers/physics_2d/step_2d_sw.cpp:66
    #6 0x102bae37 in Step2DSW::step(Space2DSW*, float, int) servers/physics_2d/step_2d_sw.cpp:225
    #7 0x100ef20b in Physics2DServerSW::step(float) servers/physics_2d/physics_2d_server_sw.cpp:1336
    #8 0x10119cfb in Physics2DServerWrapMT::step(float) servers/physics_2d/physics_2d_server_wrap_mt.cpp:81
    #9 0x18dbcd3 in Main::iteration() main/main.cpp:2110
    #10 0x17c0bd2 in OS_X11::run() platform/x11/os_x11.cpp:3641
    #11 0x172cefb in main platform/x11/godot_x11.cpp:56
    #12 0x7fd6ed6bf0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #13 0x172cb1d in _start (/usr/bin/godots+0x172cb1d)

Address 0x7fffbb8541d0 is located in stack of thread T0 at offset 496 in frame
    #0 0x10c382dd in CollisionSolver2DSW::solve_static_line(Shape2DSW const*, Transform2D const&, Shape2DSW const*, Transform2D const&, void (*)(Vector2 const&, Vector2 const&, void*), void*, bool) servers/physics_2d/collision_solver_2d_sw.cpp:37

  This frame has 17 object(s):
    [48, 52) '<unknown>'
    [64, 68) 'support_count' (line 48)
    [80, 84) '<unknown>'
    [96, 104) 'n' (line 43)
    [128, 136) '<unknown>'
    [160, 168) '<unknown>'
    [192, 200) 'p' (line 44)
    [224, 232) '<unknown>'
    [256, 264) '<unknown>'
    [288, 296) '<unknown>'
    [320, 328) '<unknown>'
    [352, 360) '<unknown>'
    [384, 392) '<unknown>'
    [416, 424) 'support_A' (line 62)
    [448, 456) '<unknown>'
    [480, 496) 'supports' (line 47) <== Memory access at offset 496 overflows this variable
    [512, 536) '<unknown>'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow core/math/transform_2d.h:52 in Transform2D::tdoty(Vector2 const&) const
servers/physics_2d/shape_2d_sw.cpp:631:28: runtime error: member access within null pointer of type 'struct Point'
servers/physics_2d/shape_2d_sw.cpp:631:34: runtime error: member call on null pointer of type 'struct Vector2'
core/math/vector2.h:190:29: runtime error: member access within null pointer of type 'const struct Vector2'
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] godots() [0x1736270] (/mnt/Miecz/godot3.2/platform/x11/crash_handler_x11.cpp:54)
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7ff476d01210] (??:0)
[3] Vector2::operator*(Vector2 const&) const (/mnt/Miecz/godot3.2/./core/math/vector2.h:190)
[4] ConvexPolygonShape2DSW::get_moment_of_inertia(float, Vector2 const&) const (/mnt/Miecz/godot3.2/servers/physics_2d/shape_2d_sw.cpp:631)
[5] Body2DSW::update_inertias() (/mnt/Miecz/godot3.2/servers/physics_2d/body_2d_sw.cpp:78)
[6] Space2DSW::setup() (/mnt/Miecz/godot3.2/servers/physics_2d/space_2d_sw.cpp:1313)
[7] Step2DSW::step(Space2DSW*, float, int) (/mnt/Miecz/godot3.2/servers/physics_2d/step_2d_sw.cpp:140)
[8] Physics2DServerSW::step(float) (/mnt/Miecz/godot3.2/servers/physics_2d/physics_2d_server_sw.cpp:1337 (discriminator 2))
[9] Physics2DServerWrapMT::step(float) (/mnt/Miecz/godot3.2/servers/physics_2d/physics_2d_server_wrap_mt.cpp:83)
[10] Main::iteration() (/mnt/Miecz/godot3.2/main/main.cpp:2112)
[11] OS_X11::run() (/mnt/Miecz/godot3.2/platform/x11/os_x11.cpp:3641)
[12] godots(main+0x326) [0x172cefc] (/mnt/Miecz/godot3.2/platform/x11/godot_x11.cpp:57)
[13] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7ff476ce20b3] (??:0)
[14] godots(_start+0x2e) [0x172cb1e] (??:?)

Steps to reproduce:

  1. Run minimal project

Minimal reproduction project:
T1.zip

@qarmin
Copy link
Contributor Author

qarmin commented Apr 7, 2021

Fixed in by linked commits

@qarmin qarmin closed this as completed Apr 7, 2021
@qarmin qarmin added this to the 4.0 milestone Apr 7, 2021
@madmiraal
Copy link
Contributor

There are still some remaining issues, but I assume they're all included in #47440 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants