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

Segfault with hides/filter_vision #4328

Open
jostephd opened this issue Sep 9, 2019 · 0 comments

Comments

@jostephd
Copy link
Member

commented Sep 9, 2019

I tried to create a regression test for #1389:

regression test
diff --git a/data/test/scenarios/filter_this_unit.cfg b/data/test/scenarios/filter_this_unit.cfg
index 9cc0c460079..6e6447938fb 100644
--- a/data/test/scenarios/filter_this_unit.cfg
+++ b/data/test/scenarios/filter_this_unit.cfg
@@ -77,6 +77,39 @@
     [/event]
 )}

+# Regression test for #1389: this used to crash
+{GENERIC_UNIT_TEST filter_hides_filter_vision (
+    [event]
+        name=prestart
+        [modify_unit]
+            [filter]
+                id=bob
+            [/filter]
+            [object]
+                [effect]
+                    apply_to=new_ability
+                    [abilities]
+                        [hides]
+                            [filter_self]
+                                [filter_vision]
+                                [/filter_vision]
+                            [/filter_self]
+                        [/hides]
+                    [/abilities]
+                [/effect]
+            [/object]
+            side=2
+        [/modify_unit]
+        [store_unit]
+            [filter]
+                [filter_vision]
+                [/filter_vision]
+            [/filter]
+        [/store_unit]
+        {SUCCEED}
+    [/event]
+)}
+
 {GENERIC_UNIT_TEST filter_fai_unit_error (
     [event]
         name=prestart

But when I run it, I get a segfault:

backtrace
$ gdb -silent -args ./wesnoth -ufilter_hides_filter_vision --validcache --log-strict=warning --noaddons
Reading symbols from ./wesnoth...(no debugging symbols found)...done.
(gdb) r
Starting program: /scratch/wesnoth-master/wesnoth -ufilter_hides_filter_vision --validcache --log-strict=warning --noaddons
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe71f5700 (LWP 22318)]
Battle for Wesnoth v1.15.1+dev (d513c499f18-Modified)
Started on Mon Sep  9 05:04:09 2019

Automatically found a possible data directory at /scratch/wesnoth-master

Data directory:               /scratch/wesnoth-master
User configuration directory: /home/USER/.config/wesnoth
User data directory:          /home/USER/.local/share/wesnoth/1.15
Cache directory:              /home/USER/.cache/wesnoth

Checking lua scripts... ok

Thread 1 "wesnoth" received signal SIGSEGV, Segmentation fault.
0x0000555555cab6a1 in unit_filter_impl::unit_filter_compound::fill(vconfig) ()
(gdb) bt 20
#0  0x0000555555cab6a1 in unit_filter_impl::unit_filter_compound::fill(vconfig) ()
#1  0x0000555555cab563 in unit_filter_impl::unit_filter_compound::unit_filter_compound(vconfig) ()
#2  0x0000555555caa872 in unit_filter::unit_filter(vconfig) ()
#3  0x0000555555c6fefc in unit::ability_affects_self(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, config const&, map_location const&) const ()
#4  0x0000555555c6ec19 in unit::get_ability_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, map_location const&) const ()
#5  0x0000555555d16163 in unit::invisible(map_location const&, bool) const ()
#6  0x0000555555ccb3ed in (anonymous namespace)::unit_filter_child_literal<unit_filter_impl::unit_filter_compound::fill(vconfig)::$_59>::matches(unit_filter_impl::unit_filter_args const&) const ()
#7  0x0000555555caab3e in unit_filter_impl::unit_filter_compound::matches(unit_filter_impl::unit_filter_args const&) const ()
#8  0x0000555555c6ff58 in unit::ability_affects_self(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, config const&, map_location const&) const ()
#9  0x0000555555c6ec19 in unit::get_ability_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, map_location const&) const ()
#10 0x0000555555d16163 in unit::invisible(map_location const&, bool) const ()
#11 0x0000555555ccb3ed in (anonymous namespace)::unit_filter_child_literal<unit_filter_impl::unit_filter_compound::fill(vconfig)::$_59>::matches(unit_filter_impl::unit_filter_args const&) const ()
#12 0x0000555555caab3e in unit_filter_impl::unit_filter_compound::matches(unit_filter_impl::unit_filter_args const&) const ()
#13 0x0000555555c6ff58 in unit::ability_affects_self(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, config const&, map_location const&) const ()
#14 0x0000555555c6ec19 in unit::get_ability_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, map_location const&) const ()
#15 0x0000555555d16163 in unit::invisible(map_location const&, bool) const ()
#16 0x0000555555ccb3ed in (anonymous namespace)::unit_filter_child_literal<unit_filter_impl::unit_filter_compound::fill(vconfig)::$_59>::matches(unit_filter_impl::unit_filter_args const&) const ()
#17 0x0000555555caab3e in unit_filter_impl::unit_filter_compound::matches(unit_filter_impl::unit_filter_args const&) const ()
#18 0x0000555555c6ff58 in unit::ability_affects_self(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, config const&, map_location const&) const ()
#19 0x0000555555c6ec19 in unit::get_ability_bool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, map_location const&) const ()
(More stack frames follow...)
(gdb) 

I guess the fix to #1389 was incomplete. It did fix the test case in #1389 (comment), though.

@jostephd jostephd added Bug WML labels Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.