Skip to content

[3.x] Changing the class a GDScript file extends crashes the engine. #53238

Closed
@Rubonnek

Description

Godot version

3.x branch at 0a7c6c0

System information

Arch Linux

Issue description

Changing the class a GDScript file extends crashes the engine.

Steps to reproduce

  1. Create a new project with a single Node2D
  2. Add the following script to the node:
extends Node2D

func _ready() -> void:
	pass
  1. Close the script.
  2. Open the file with an external editor and have the external editor connect an LSP client to Godot. (Vim ALE was used in this case).
  3. Change the class the script extends to Reference, and save the file.
  4. Godot should crash with an illegal instruction due to CRASH_BAD_INDEX triggered by ExtendGDScriptParser::parse_documentation

Here is the backtrace:

(gdb) bt
#0  0x0000000000b1edef in CowData<String>::get (p_index=1, this=0x7fff115990b0) at ./core/cowdata.h:156
#1  Vector<String>::operator[] (p_index=1, this=0x7fff115990a8) at ./core/vector.h:87
#2  ExtendGDScriptParser::parse_documentation (this=0x7fff11598f90, p_line=0, p_docs_down=true) at modules/gdscript/language_server/gdscript_extend_parser.cpp:412
#3  0x0000000000b18061 in ExtendGDScriptParser::parse_class_symbol (this=0x7fff11598f90, p_class=0x7fff1158bd10, r_symbol=...) at modules/gdscript/language_server/gdscript_extend_parser.cpp:159
#4  0x0000000000b170c1 in ExtendGDScriptParser::update_symbols (this=0x7fff11598f90) at modules/gdscript/language_server/gdscript_extend_parser.cpp:87
#5  0x0000000000b2976e in ExtendGDScriptParser::parse (this=0x7fff11598f90, p_code=..., p_path=...) at modules/gdscript/language_server/gdscript_extend_parser.cpp:788
#6  0x0000000000716abe in GDScriptWorkspace::parse_script (this=0xc7d9a70, p_path=..., p_content=...) at modules/gdscript/language_server/gdscript_workspace.cpp:420
#7  0x00000000007123a6 in GDScriptWorkspace::reload_all_workspace_scripts (this=0xc7d9a70) at modules/gdscript/language_server/gdscript_workspace.cpp:205
#8  0x000000000071605a in GDScriptWorkspace::initialize (this=0xc7d9a70) at modules/gdscript/language_server/gdscript_workspace.cpp:393
#9  0x00000000006e27c2 in GDScriptLanguageProtocol::initialize (this=0x8f0cdd8, p_params=...) at modules/gdscript/language_server/gdscript_language_protocol.cpp:203
#10 0x00000000006f2f31 in MethodBind1R<Dictionary, Dictionary const&>::call (this=0xc7d6030, p_object=0x8f0cdd8, p_args=0x7fff1d7f9750, p_arg_count=1, r_error=...) at ./core/method_bind.gen.inc:961
#11 0x000000000474b606 in Object::call (this=0x8f0cdd8, p_method=..., p_args=0x7fff1d7f9750, p_argcount=1, r_error=...) at core/object.cpp:918
#12 0x000000000474ae2c in Object::callv (this=0x8f0cdd8, p_method=..., p_args=...) at core/object.cpp:827
#13 0x000000000074257e in JSONRPC::process_action (this=0x8f0cdd8, p_action=..., p_process_arr_elements=true) at modules/jsonrpc/jsonrpc.cpp:129
#14 0x0000000000742f83 in JSONRPC::process_string (this=0x8f0cdd8, p_input=...) at modules/jsonrpc/jsonrpc.cpp:165
#15 0x00000000006e056a in GDScriptLanguageProtocol::process_message (this=0x8f0cdd8, p_text=...) at modules/gdscript/language_server/gdscript_language_protocol.cpp:141
#16 0x00000000006dfc20 in GDScriptLanguageProtocol::LSPeer::handle_data (this=0x7fff100011d0) at modules/gdscript/language_server/gdscript_language_protocol.cpp:96
#17 0x00000000006e4214 in GDScriptLanguageProtocol::poll (this=0x8f0cdd8) at modules/gdscript/language_server/gdscript_language_protocol.cpp:242
#18 0x00000000006f4f82 in GDScriptLanguageServer::thread_main (p_userdata=0x8f0cbb0) at modules/gdscript/language_server/gdscript_language_server.cpp:81
#19 0x000000000490e967 in Thread::callback (p_self=0x8f0cf30, p_settings=..., p_callback=0x6f4f5a <GDScriptLanguageServer::thread_main(void*)>, p_userdata=0x8f0cbb0) at core/os/thread.cpp:79
#20 0x000000000490f8af in std::__invoke_impl<void, void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> (__f=@0xd138448: 0x490e8ca <Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*)>) at /usr/include/c++/11.1.0/bits/invoke.h:61
#21 0x000000000490f732 in std::__invoke<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> (__fn=@0xd138448: 0x490e8ca <Thread::callback(Thread*, Thread::Settings const&, void (*)(void*), void*)>) at /usr/include/c++/11.1.0/bits/invoke.h:96
#22 0x000000000490f5ed in std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul> (this=0xd138428) at /usr/include/c++/11.1.0/bits/std_thread.h:253
#23 0x000000000490f552 in std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> >::operator() (this=0xd138428) at /usr/include/c++/11.1.0/bits/std_thread.h:260
#24 0x000000000490f536 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(Thread*, Thread::Settings const&, void (*)(void*), void*), Thread*, Thread::Settings, void (*)(void*), void*> > >::_M_run (this=0xd138420) at /usr/include/c++/11.1.0/bits/std_thread.h:211
#25 0x0000000004e2a304 in execute_native_thread_routine ()
#26 0x00007ffff7d68259 in start_thread () from /usr/lib/libpthread.so.0
#27 0x00007ffff7b465e3 in clone () from /usr/lib/libc.so.6

Edit: For the steps outlined above, here is the Vim ALE LSP interaction with the LSP server. Here is the full backtrace.

Minimal reproduction project

A brand new project will do.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions