Bug#674597: goplay: Segfault if selection is moved out of bound

Petter Reinholdtsen pere at hungry.com
Fri May 3 04:14:26 UTC 2013


[Sebastian Reichel]
> Start goplay, select the first game (currently "0ad"). Next press the
> up key from the arrows keys [0] and it will segfault.

Thank you.  With this description, I can reproduce it.  The segfault
give this backtrace:

(gdb) bt
#0  __strlen_sse2 () at ../sysdeps/i386/i686/multiarch/strlen.S:99
#1  0x0805a56e in std::char_traits<char>::length (this=0x80a5870, p=0x8cebf78, 
    s=1) at /usr/include/c++/4.4/bits/char_traits.h:263
#2  std::string::assign (this=0x80a5870, p=0x8cebf78, s=1)
    at /usr/include/c++/4.4/bits/basic_string.h:975
#3  std::string::operator= (this=0x80a5870, p=0x8cebf78, s=1)
    at /usr/include/c++/4.4/bits/basic_string.h:519
#4  PackageBrowser::item_select (this=0x80a5870, p=0x8cebf78, s=1)
    at pkgbrowser.cpp:231
#5  0xb7f32374 in Fl_Browser_::select(void*, int, int) ()
   from /usr/lib/libfltk.so.1.1
#6  0xb7f324c3 in Fl_Browser_::select_only(void*, int) ()
   from /usr/lib/libfltk.so.1.1
#7  0xb7f32782 in Fl_Browser_::handle(int) () from /usr/lib/libfltk.so.1.1
#8  0x08058914 in VersatileBrowser::handle (this=0x80a5870, e=8)
    at pkgbrowser.h:145
#9  PackageBrowser::handle (this=0x80a5870, e=8) at pkgbrowser.cpp:498
#10 0xb7f2bcd4 in ?? () from /usr/lib/libfltk.so.1.1
#11 0xb7f2ce1a in Fl::handle(int, Fl_Window*) () from /usr/lib/libfltk.so.1.1
#12 0xb7f7cf62 in fl_handle(_XEvent const&) () from /usr/lib/libfltk.so.1.1
#13 0xb7f7e24e in ?? () from /usr/lib/libfltk.so.1.1
#14 0xb7f7e620 in fl_wait(double) () from /usr/lib/libfltk.so.1.1
#15 0xb7f2d9db in Fl::wait(double) () from /usr/lib/libfltk.so.1.1
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) q

The inclued patch avoid the segfault, but allow the table header line
to be selected and do not update the side bar with information about
the selected package, so it is not really a proper fix for the
problem.  I guess a proper fix would involve telling FLTK to avoid the
header line in the list.

Index: src/pkgbrowser.cpp
===================================================================
--- src/pkgbrowser.cpp  (revisjon 14003)
+++ src/pkgbrowser.cpp  (arbeidskopi)
@@ -228,12 +228,12 @@
        {
                int n = VersatileBrowser::lineno(p);
                void *data = VersatileBrowser::data(n);
-               pkgname = (const char*) data;
                //printf("  #%d : \"%s\"\n", n, (const char *)data);
                //fflush(stdout);
 
                if (data)
                {
+                       pkgname = (const char*) data;
                        const char *packagename = (const char *)data;
                        Fl_Image *img = find_screenshot(packagename);
                        Fl_Group *highest_parent=parent();

-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-games-devel mailing list