unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6855: 24.0.50; Bug in tool bar label handling
@ 2010-08-14 12:04 Johan Bockgård
  2010-08-15  8:20 ` Jan Djärv
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Bockgård @ 2010-08-14 12:04 UTC (permalink / raw)
  To: 6855


There are some bugs in the handling of tool bar labels that can cause
Emacs to crash.



### gtkutil.c: update_frame_tool_bar ###

    char *label = SSDATA (PROP (TOOL_BAR_ITEM_LABEL));

Here we take string data out.



### keyboard.c: parse_tool_bar_item ###

      else if (EQ (key, QClabel))
        {
          /* `:label LABEL-STRING'.  */
          PROP (TOOL_BAR_ITEM_LABEL) = value;
          have_label = 1;
        }

But here we put an arbitrary object in.


...

  if (!have_label)

...
      char buf[64];
      EMACS_INT max_lbl = 2*tool_bar_max_label_size;
      Lisp_Object new_lbl;

      if (strlen (caption) < max_lbl && caption[0] != '\0')
        {
          strcpy (buf, caption);

tool-bar-max-label-size is a user variable, so this can mean a buffer
overflow.


...
      if (SCHARS (new_lbl) <= tool_bar_max_label_size)
        PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;

If we came here but the branch is not taken, the label will be nil,
not a string.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-15 11:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14 12:04 bug#6855: 24.0.50; Bug in tool bar label handling Johan Bockgård
2010-08-15  8:20 ` Jan Djärv
2010-08-15  8:51   ` Andreas Schwab
2010-08-15 10:21     ` Jan Djärv
2010-08-15 10:37       ` Andreas Schwab
2010-08-15 11:41       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).