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

textadept-gtk, stack smashing detected #443

Closed
jk411 opened this issue Aug 13, 2023 · 1 comment
Closed

textadept-gtk, stack smashing detected #443

jk411 opened this issue Aug 13, 2023 · 1 comment

Comments

@jk411
Copy link

jk411 commented Aug 13, 2023

Textadept-gtk 12.0 compiled from sources on Void Linux
with optimizations enabled:

export CFLAGS=-O2
export CXXFLAGS=-O2

ctrl+P or ctrl+shift+L ...
fail on arrow-down (text entry must be empty):

...
[Thread 0x7fffe77fe6c0 (LWP 9900) exited]
[Thread 0x7fffe6ffd6c0 (LWP 9901) exited]
[New Thread 0x7fffe6ffd6c0 (LWP 9902)]
[New Thread 0x7fffe77fe6c0 (LWP 9903)]
[Thread 0x7fffe6ffd6c0 (LWP 9902) exited]
[Thread 0x7fffe77fe6c0 (LWP 9903) exited]
*** stack smashing detected ***: terminated

Thread 1 "textadept-gtk" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44 pthread_kill.c: No such file or directory.
(gdb) bt
#0 __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007ffff6aa277f in __pthread_kill_internal (signo=6, threadid=) at pthread_kill.c:78
#2 0x00007ffff6a561a2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff6a40477 in __GI_abort () at abort.c:79
#4 0x00007ffff6a96987 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff6bb3486 "*** %s ***: terminated\n")
at ../sysdeps/posix/libc_fatal.c:155
#5 0x00007ffff6b304a2 in __GI___fortify_fail (msg=msg@entry=0x7ffff6bb346e "stack smashing detected") at fortify_fail.c:26
#6 0x00007ffff6b30472 in __stack_chk_fail () at stack_chk_fail.c:24
#7 0x00005555555ba71b in entry_keypress (entry=0x555555d13690, event=, treeview=0x555555d1ffe0)
at /home/user/downloads/textadept-textadept_12.0/src/textadept_gtk.c:673
#8 0x00007ffff768ec47 in ?? () from /usr/lib/libgtk-3.so.0
#9 0x00007ffff7199450 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#10 0x00007ffff71ac626 in ?? () from /usr/lib/libgobject-2.0.so.0
...

maybe:

--- textadept_gtk.c.orig        2023-07-31 22:36:54.000000000 +0000
+++ textadept_gtk.c     2023-08-13 12:08:47.405882169 +0000
@@ -661,11 +661,11 @@
 // This is needed to scroll through list items when interactive search is not active.
 // Note: key-press-event is never emitted for some reason (perhaps because this widget is an
 // interactive search widget).
 static int entry_keypress(GtkWidget *entry, GdkEventKey *event, void *treeview) {
        if (*gtk_entry_get_text(GTK_ENTRY(entry))) return false;
-       bool down = event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_Page_Down,
+       int down = event->keyval == GDK_KEY_Down || event->keyval == GDK_KEY_Page_Down,
                         page = event->keyval == GDK_KEY_Page_Down || event->keyval == GDK_KEY_Page_Up, moved;
        if (!down && !page && event->keyval != GDK_KEY_Up) return false;
        gtk_widget_grab_focus(treeview);
        g_signal_emit_by_name(treeview, "move-cursor",
                !page ? GTK_MOVEMENT_DISPLAY_LINES : GTK_MOVEMENT_PAGES, down ? 1 : -1, &moved);

optimized sizeof(moved) may be 1 because of bool
g_signal_emit_by_name(... &moved) may be expecting something else ...

@orbitalquark
Copy link
Owner

You are correct. Thanks for catching that. Fixed via ffa1679.

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

No branches or pull requests

2 participants