all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
@ 2016-04-10 10:49 Matthew Leach
  2016-04-10 15:01 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Leach @ 2016-04-10 10:49 UTC (permalink / raw)
  To: 23259

[-- Attachment #1: Type: text/plain, Size: 5535 bytes --]

Recipe:

emacs -Q
open a file, emacs/src/process.c, say.
C-x C-=
and keep pressing
C-=

Emacs will grind to a halt a little but will eventually segfault when
the zoom is extreme enough.

Attached is the backtrace.  It looks as though X has thrown an error,
maybe we need to limit the amount of zoom that Emacs allows?

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-03-24 built on spline
Repository revision: 39577d07124ee16895b9c6aab7e2c6e7d41cc715
Windowing system distributor 'The X.Org Foundation', version 11.0.11803000
Configured using:
 'configure --prefix=/usr/local'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_GB.UTF8
  locale-coding-system: utf-8-unix

Major mode: Group

Minor modes in effect:
  text-scale-mode: t
  gnus-topic-mode: t
  gnus-undo-mode: t
  diff-auto-refine-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Checking new news...done
Checking new news...
Reading active file via nndraft...done
Checking new news...done
Checking new news...
Reading active file via nndraft...done
Checking new news...done
Checking new news...
Reading active file via nndraft...done
Checking new news...done

Load-path shadows:
/home/matthew/.emacs.d/elpa/emms-20160304.920/tq hides /usr/local/share/emacs/25.1.50/lisp/emacs-lisp/tq

Features:
(shadow emacsbug ielm shr-color color shr svg dom mm-archive face-remap
nnir smiley gnus-cite mail-extr gnus-async gnus-bcklg qp gnus-ml
gnus-topic nndraft nnmh utf-7 nnfolder bbdb-gnus bbdb-mua bbdb-com crm
network-stream puny nsm starttls gnus-agent gnus-srvr gnus-score
score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime dig gnus-cache gnus-sum bbdb-message sendmail bbdb bbdb-site
timezone gnus-demon nntp gnus-group gnus-undo gnus-article-treat-patch
diff-mode gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rfc822
mml mml-sec epa derived epg mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader subr-x
gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mail-utils
mm-util mail-prsvr wid-edit conf-toplev conf-sp smartparens dash
conf-coffee conf-windmove windmove conf-whitespace conf-slime slime-repl
slime-parse slime compile etags xref project arc-mode archive-mode
noutline outline pp hyperspec browse-url conf-faces hl-sexp thingatpt
conf-eshell em-term term disp-table ehelp em-smart pcomplete comint
ansi-color ring esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg
esh-groups eshell esh-module esh-mode esh-util conf-erc conf-emms
emms-librefm-stream xml emms-librefm-scrobbler emms-playlist-limit
emms-volume easy-mmode emms-volume-amixer emms-i18n emms-history
emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks
emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort
emms-last-played emms-player-xine emms-player-mpd tq emms-lyrics
emms-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util mailcap emms-streams emms-show-all
emms-tag-editor format-spec emms-mark emms-cache emms-info-ogginfo
emms-info-mp3info emms-playlist-mode emms-player-vlc advice
emms-source-playlist emms-source-file locate dired dired-loaddefs
emms-player-mplayer emms-playing-time emms-player-simple emms-info
later-do emms-setup emms-mode-line emms emms-compat conf-elisp
conf-packages conf-dir conf-dired conf-c-mode conf-auctex conf-asm
conf-ace-jump conf-personal ido seq edmacro kmacro paren preview-latex
tex-site auto-loads finder-inf slime-autoloads url-auth info package
epg-config url-handlers url-parse auth-source cl-seq eieio byte-opt
bytecomp byte-compile cl-extra help-mode easymenu cconv eieio-core
cl-macs gv eieio-loaddefs cl-loaddefs pcase cl-lib password-cache
url-vars time-date mule-util tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 280541 38221)
 (symbols 48 48084 0)
 (miscs 40 175 424)
 (strings 32 84243 9005)
 (string-bytes 1 2667208)
 (vectors 16 37227)
 (vector-slots 8 744155 16170)
 (floats 8 683 853)
 (intervals 56 690 22)
 (buffers 976 38)
 (heap 1024 68673 3320))

-- 
Matt


[-- Attachment #2: gdb.txt --]
[-- Type: text/plain, Size: 7417 bytes --]

#0  terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:369
No locals.
#1  0x00000000005022f3 in emacs_abort () at sysdep.c:2255
No locals.
#2  0x00000000004bbc21 in x_connection_closed (dpy=dpy@entry=0x14bc000, error_message=<optimized out>, 
    error_message@entry=0x7fffffffd960 "X protocol error: BadLength (poly request too large or internal Xlib length error) on protocol request 139", ioerror=ioerror@entry=false) at xterm.c:9462
        tail = <optimized out>
#3  0x00000000004c0115 in x_error_quitter (display=0x14bc000, event=0x7fffffffdb20, event=0x7fffffffdb20) at xterm.c:9553
        buf = "BadLength (poly request too large or internal Xlib length error)", '\000' <repeats 191 times>
        buf1 = "X protocol error: BadLength (poly request too large or internal Xlib length error) on protocol request 139", '\000' <repeats 158 times>...
#4  0x00000000004c019b in x_error_handler (display=0x14bc000, event=0x7fffffffdb20) at xterm.c:9523
No locals.
#5  0x00007ffff490a87d in _XError () from /usr/lib/libX11.so.6
No symbol table info available.
#6  0x00007ffff49077c7 in ?? () from /usr/lib/libX11.so.6
No symbol table info available.
#7  0x00007ffff4907885 in ?? () from /usr/lib/libX11.so.6
No symbol table info available.
#8  0x00007ffff4908235 in _XEventsQueued () from /usr/lib/libX11.so.6
No symbol table info available.
#9  0x00007ffff48f9b87 in XPending () from /usr/lib/libX11.so.6
No symbol table info available.
#10 0x00007ffff674f59e in ?? () from /usr/lib/libgdk-3.so.0
No symbol table info available.
#11 0x00007ffff507668d in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#12 0x00007ffff507702b in ?? () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#13 0x00007ffff50771b7 in g_main_context_pending () from /usr/lib/libglib-2.0.so.0
No symbol table info available.
#14 0x00007ffff6be959d in gtk_events_pending () from /usr/lib/libgtk-3.so.0
No symbol table info available.
#15 0x00000000004bcb6b in XTread_socket (terminal=<optimized out>, hold_quit=0x7fffffffde10) at xterm.c:8772
        count = 0
        dpyinfo = 0x1559c00
#16 0x00000000004f0af9 in gobble_input () at keyboard.c:6801
        nr = <optimized out>
        hold_quit = {
          kind = NO_EVENT, 
          part = scroll_bar_nowhere, 
          code = 0, 
          modifiers = 0, 
          x = 0, 
          y = 0, 
          timestamp = 0, 
          frame_or_window = 0, 
          arg = 0
        }
        next = 0x0
        nread = 0
        err = false
        t = 0x11a7cd0
#17 0x00000000004f04c5 in handle_async_input () at keyboard.c:7053
        nread = <optimized out>
#18 process_pending_signals () at keyboard.c:7067
No locals.
#19 0x000000000055ad45 in Ffuncall (nargs=nargs@entry=1, args=args@entry=0x7fffffffdf38) at eval.c:2639
        fun = <optimized out>
        original_fun = <optimized out>
        numargs = 0
        val = <optimized out>
        internal_args = <optimized out>
        count = <optimized out>
#20 0x000000000055af38 in call0 (fn=8803984) at eval.c:2552
No locals.
#21 0x00000000004ec656 in timer_start_idle () at keyboard.c:4241
No locals.
#22 0x00000000004f53fb in timer_start_idle () at keyboard.c:4047
No locals.
#23 read_char (commandflag=commandflag@entry=1, map=map@entry=40159507, prev_event=0, 
    used_mouse_menu=used_mouse_menu@entry=0x7fffffffe5bb, end_time=end_time@entry=0x0) at keyboard.c:2599
        c = 0
        jmpcount = 2
        local_getcjmp = {{
            __jmpbuf = {0, -1876234902778123125, 28329072, 23142480, 140737488348816, 40159507, 1876237390707846283, 
              -1876236781231903605}, 
            __mask_was_saved = 0, 
            __saved_mask = {
              __val = {29009957, 0, 1, 0 <repeats 13 times>}
            }
          }}
        save_jump = {{
            __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 0}, 
            __mask_was_saved = 0, 
            __saved_mask = {
              __val = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5943704, 2, 16339680, 30, 5541974, 17312880}
            }
          }}
        tem = <optimized out>
        save = <optimized out>
        previous_echo_area_message = 0
        also_record = 0
        reread = false
        recorded = false
        polling_stopped_here = false
        orig_kboard = 0x1612050
#24 0x00000000004f640a in read_key_sequence (keybuf=keybuf@entry=0x7fffffffe690, prompt=prompt@entry=0, 
    dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, bufsize=30) at keyboard.c:9054
        interrupted_kboard = 0x1612050
        interrupted_frame = 0x1218e90
        key = <optimized out>
        used_mouse_menu = false
        echo_local_start = 0
        last_real_key_start = <optimized out>
        keys_local_start = <optimized out>
        new_binding = <optimized out>
        t = <optimized out>
        echo_start = 0
        keys_start = 0
        current_binding = 40159507
        first_event = 0
        first_unbound = 31
        mock_input = 0
        fkey = {
          parent = 16686083, 
          map = 16686083, 
          start = 0, 
          end = 0
        }
        keytran = {
          parent = 12516931, 
          map = 12516931, 
          start = 0, 
          end = 0
        }
        indec = {
          parent = 16686099, 
          map = 16686099, 
          start = 0, 
          end = 0
        }
        shift_translated = false
        delayed_switch_frame = 0
        original_uppercase = 0
        original_uppercase_position = -1
        dummyflag = false
        fake_prefixed_keys = 0
#25 0x00000000004f7fe6 in command_loop_1 () at keyboard.c:1357
        cmd = <optimized out>
        keybuf = {268435702, 268435702, 9903877, 0, 0, 5660497, 9903872, 28656, 0, 12278528, 0, 0, 0, 4410541, 0, 5542814, 0, 0, 0, 
          28656, 28656, 0, 12723443, 4002, 140737488349664, 5544553, 28656, 64, 0, 5610273}
        i = <optimized out>
        prev_modiff = 1428
        prev_buffer = 0x1baa820
#26 0x0000000000559602 in internal_condition_case (bfun=bfun@entry=0x4f7df0 <command_loop_1>, handlers=handlers@entry=19296, 
    hfun=hfun@entry=0x4ee8b0 <cmd_error>) at eval.c:1310
        val = <optimized out>
        c = <optimized out>
#27 0x00000000004e9fbc in command_loop_2 (ignore=ignore@entry=0) at keyboard.c:1099
        val = 271
#28 0x00000000005595a3 in internal_catch (tag=tag@entry=46128, func=func@entry=0x4e9fa0 <command_loop_2>, arg=arg@entry=0)
    at eval.c:1075
        val = <optimized out>
        c = <optimized out>
#29 0x00000000004e9f79 in command_loop () at keyboard.c:1078
No locals.
#30 0x00000000004ee49b in recursive_edit_1 () at keyboard.c:684
        val = <optimized out>
#31 0x00000000004ee7e8 in Frecursive_edit () at keyboard.c:755
        buffer = <optimized out>
#32 0x0000000000417433 in main (argc=1, argv=0x7fffffffe9e8) at emacs.c:1646
        dummy = 0
        stack_bottom_variable = 0 '\000'
        do_initial_setlocale = <optimized out>
        dumping = <optimized out>
        skip_args = 0
        rlim = {
          rlim_cur = 8720000, 
          rlim_max = 18446744073709551615
        }
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = <optimized out>

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

* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
  2016-04-10 10:49 bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault Matthew Leach
@ 2016-04-10 15:01 ` Eli Zaretskii
  2016-04-10 15:33   ` Matthew Leach
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-04-10 15:01 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 23259

> From: Matthew Leach <matthew@mattleach.net>
> Date: Sun, 10 Apr 2016 11:49:12 +0100
> 
> emacs -Q
> open a file, emacs/src/process.c, say.
> C-x C-=
> and keep pressing
> C-=
> 
> Emacs will grind to a halt a little but will eventually segfault when
> the zoom is extreme enough.
> 
> Attached is the backtrace.  It looks as though X has thrown an error,
> maybe we need to limit the amount of zoom that Emacs allows?

Probably.  However, the interesting question is: what values to use as
limits?

Also, this backtrace is not useful, since the X errors are by default
asynchronous.  Could you please run Emacs in synchronous X mode (see
etc/DEBUG for how), and present the backtrace then?  Also, please
tell:

  . what is the maximum value of the scale factor you see on the mode
    line before Emacs crashes

  . what is the value returned by display-pixel-width

  . what is the values returned by frame-char-width and
    frame-char-height

I'll try to prepare a patch using the above data.

Thanks.





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

* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
  2016-04-10 15:01 ` Eli Zaretskii
@ 2016-04-10 15:33   ` Matthew Leach
  2016-04-10 16:24     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Leach @ 2016-04-10 15:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23259

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Matthew Leach <matthew@mattleach.net>
>> Date: Sun, 10 Apr 2016 11:49:12 +0100
>> 
>> emacs -Q
>> open a file, emacs/src/process.c, say.
>> C-x C-=
>> and keep pressing
>> C-=
>> 
>> Emacs will grind to a halt a little but will eventually segfault when
>> the zoom is extreme enough.
>> 
>> Attached is the backtrace.  It looks as though X has thrown an error,
>> maybe we need to limit the amount of zoom that Emacs allows?
>
> Probably.  However, the interesting question is: what values to use as
> limits?

Maybe limit the zoom before X would crash?  Presumably X has an upper
bound on how large it can render things since it can yield a BadLength
error.  However, I've never studied X before.

> Also, this backtrace is not useful, since the X errors are by default
> asynchronous.  Could you please run Emacs in synchronous X mode (see
> etc/DEBUG for how), and present the backtrace then?  

Sure, please see attached.

> Also, please tell:
>
>   . what is the maximum value of the scale factor you see on the mode
>     line before Emacs crashes

I can get to about +34 before it crashes.

>   . what is the value returned by display-pixel-width

(display-pixel-width) => 1366

>   . what is the values returned by frame-char-width and
>     frame-char-height

(frame-char-width) => 9
(frame-char-height) => 18

Hope this helps.
-- 
Matt

[-- Attachment #2: gdb.txt --]
[-- Type: text/plain, Size: 11117 bytes --]

Breakpoint 3 at 0x51dec7: file xterm.c, line 9544.
Starting program: /home/matthew/Development/emacs/src/emacs -xrm "emacs.synchronous: true"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe8938700 (LWP 25309)]
[New Thread 0x7fffe3b8f700 (LWP 25310)]
[New Thread 0x7fffe3181700 (LWP 25311)]

Thread 1 "emacs" hit Breakpoint 3, x_error_quitter (display=0x1579d40, event=0x7fffffff9aa0) at xterm.c:9544
9544	  if (event->error_code == BadName)
#0  x_error_quitter (display=0x1579d40, event=0x7fffffff9aa0) at xterm.c:9544
        buf = "\200\231\377\377\377\177", '\000' <repeats 18 times>, "\220\257W\001", '\000' <repeats 12 times>, "$\031\002\361\377\177\000\000\220\333n\002", '\000' <repeats 12 times>, " \000\000\000\000\000\000\000o\341J\364\377\177\000\000\000\000\000\000\000\000\000\000 \000\000\000\000\000\000\000X\300W\001\000\000\000\000\000\000\000\000\001\000\000\000 \300W\001\000\000\000\000\000\212\"\274\235\207Q\364\004\260W\001\000\000\000\000\220\257W\001", '\000' <repeats 12 times>, "\250\257W\001", '\000' <repeats 12 times>, "\001\000\000\000\000\000\000\000 \232\377\377\377\177\000\000Q\275J\364\377\177\000\000\006\000\000\000\001\000\001\000"...
        buf1 = "\314\n\000\000\000\000\000\000S\000\000\000\000\000\000\000[\231\000\000\377\177\000\000\020\230\377\377\377\177\000\000\315\n\000\000\000\000\000\000\255\000\000\000\000\000\000\000\020\066\000\000\000\000\000\000Ѐ\377\377\377\177\000\000\315\n\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\030\001\000\000\000\000\000\003\000\000\000\377\177\000\000\020\000\000\000\000\000\000\000P", '\000' <repeats 15 times>, "\003\000\000\000\060", '\000' <repeats 19 times>, "[\000\000\000n\000\000\000O\332J\364\377\177\000\000\300\333n\002\000\000\000\000w\000\000\000|", '\000' <repeats 12 times>, "K4\361\377\177\000\000\020\000\000\000\000\000\000\000\001\001"...
#1  0x000000000051dea7 in x_error_handler (display=0x1579d40, event=0x7fffffff9aa0) at xterm.c:9523
No locals.
#2  0x00007ffff490a87d in _XError () from /usr/lib/libX11.so.6
No symbol table info available.
#3  0x00007ffff49077c7 in ?? () from /usr/lib/libX11.so.6
No symbol table info available.
#4  0x00007ffff4907885 in ?? () from /usr/lib/libX11.so.6
No symbol table info available.
#5  0x00007ffff4908830 in _XReply () from /usr/lib/libX11.so.6
No symbol table info available.
#6  0x00007ffff490411d in XSync () from /usr/lib/libX11.so.6
No symbol table info available.
#7  0x00007ffff49041bb in ?? () from /usr/lib/libX11.so.6
No symbol table info available.
#8  0x00007ffff429a151 in XRenderAddGlyphs () from /usr/lib/libXrender.so.1
No symbol table info available.
#9  0x00007ffff408e9e2 in XftFontLoadGlyphs () from /usr/lib/libXft.so.2
No symbol table info available.
#10 0x00007ffff4090bb3 in XftGlyphRender () from /usr/lib/libXft.so.2
No symbol table info available.
#11 0x00007ffff408a1cc in XftDrawGlyphs () from /usr/lib/libXft.so.2
No symbol table info available.
#12 0x000000000066df26 in xftfont_draw (s=0x7fffffffc5a0, from=0, to=1, x=8, y=6865, with_background=true) at xftfont.c:636
        f = 0x12d8680
        face = 0x26cab00
        xftfont_info = 0x26db8b8
        xftface_info = 0x26caad0
        xft_draw = 0x1e1df80
        code = 0x7fffffffc370
        fg = {
          pixel = 11674146, 
          color = {
            red = 45746, 
            green = 8738, 
            blue = 8738, 
            alpha = 65535
          }
        }
        bg = {
          pixel = 16777215, 
          color = {
            red = 65535, 
            green = 65535, 
            blue = 65535, 
            alpha = 65535
          }
        }
        len = 1
        i = 1
#13 0x000000000051044b in x_draw_glyph_string_foreground (s=0x7fffffffc5a0) at xterm.c:1775
        font = 0x26db8b8
        boff = 0
        y = 6865
        i = 0
        x = 8
#14 0x000000000051473f in x_draw_glyph_string (s=0x7fffffffc5a0) at xterm.c:3528
        relief_drawn_p = false
#15 0x00000000004806c9 in draw_glyphs (w=0x12d9690, x=4461, row=0x228bdf0, area=TEXT_AREA, start=0, end=1, hl=DRAW_NORMAL_TEXT, overlaps=0) at xdisp.c:25706
        head = 0x7fffffffc5a0
        tail = 0x7fffffffc5a0
        s = 0x7fffffffc5a0
        clip_head = 0x0
        clip_tail = 0x0
        i = 1
        j = 0
        x_reached = 4461
        last_x = 1358
        area_left = 8
        f = 0x12d8680
        sa_avail = 16382
        sa_count = 5
        sa_must_free = false
#16 0x00000000004871ff in x_write_glyphs (w=0x12d9690, updated_row=0x228bdf0, start=0x2291000, updated_area=TEXT_AREA, len=1) at xdisp.c:27675
        x = 0
        hpos = 0
        chpos = 0
#17 0x000000000041d635 in update_text_area (w=0x12d9690, updated_row=0x228bdf0, vpos=0) at dispnew.c:3612
        current_row = 0x2378570
        desired_row = 0x228bdf0
        rif = 0x9010c0 <x_redisplay_interface>
        changed_p = false
#18 0x000000000041dfff in update_window_line (w=0x12d9690, vpos=0, mouse_face_overwritten_p=0x7fffffffcb2f) at dispnew.c:3855
        current_row = 0x2378570
        desired_row = 0x228bdf0
        rif = 0x9010c0 <x_redisplay_interface>
        changed_p = false
#19 0x000000000041d197 in update_window (w=0x12d9690, force_p=true) at dispnew.c:3477
        vpos = 0
        i = 4
        end = 0x228f5f0
        mode_line_row = 0x228f5f0
        header_line_row = 0x0
        changed_p = false
        mouse_face_overwritten_p = false
        row = 0x228bdf0
        yb = 732
        n_updated = 0
        desired_matrix = 0x168a7b0
        paused_p = false
        preempt_count = 9
        rif = 0x9010c0 <x_redisplay_interface>
#20 0x000000000041c88a in update_window_tree (w=0x12d9690, force_p=true) at dispnew.c:3219
        paused_p = false
#21 0x000000000041c4b5 in update_frame (f=0x12d8680, force_p=true, inhibit_hairy_id_p=false) at dispnew.c:3108
        paused_p = false
        root_window = 0x12d9690
#22 0x0000000000458ad2 in redisplay_internal () at xdisp.c:14010
        gcscrollbars = true
        f_redisplay_flag = false
        f = 0x12d8680
        w = 0x12d9690
        sw = 0x12d9690
        fr = 0x12d8680
        pending = false
        must_finish = true
        match_p = true
        tlbufpos = {
          charpos = 0, 
          bytepos = 1
        }
        tlendpos = {
          charpos = 237464, 
          bytepos = 237464
        }
        number_of_visible_frames = 1
        count = 2
        sf = 0x12d8680
        polling_stopped_here = true
        tail = 17498227
        frame = 19760773
        consider_all_windows_p = true
        update_miniwindow_p = true
#23 0x0000000000456b34 in redisplay () at xdisp.c:13204
No locals.
#24 0x0000000000556e38 in read_char (commandflag=1, map=40660771, prev_event=0, used_mouse_menu=0x7fffffffe36f, end_time=0x0) at keyboard.c:2469
        echo_current = false
        c = 0
        jmpcount = 13028656
        local_getcjmp = {{
            __jmpbuf = {5552513, 15899701, 140737488347520, 6101750, 17843168, 18673408, 0, 140737488347520}, 
            __mask_was_saved = 5552513, 
            __saved_mask = {
              __val = {17843168, 13028656, 6102329, 0, 140737488347568, 5552513, 18673408, 13028656, 5685754, 0, 140737488347616, 5552513, 40660755, 140737488347712, 6227505, 0}
            }
          }}
        save_jump = {{
            __jmpbuf = {0, 0, 0, 0, 0, 0, 0, 25769803776}, 
            __mask_was_saved = 15899696, 
            __saved_mask = {
              __val = {140737488347352, 5556855, 25769803776, 15899701, 0, 15899696, 15899696, 5557072, 29712, 140737488347536, 6647043, 0, 0, 13028656, 6, 0}
            }
          }}
        tem = 40660771
        save = 0
        previous_echo_area_message = 0
        also_record = 0
        reread = false
        recorded = false
        polling_stopped_here = false
        orig_kboard = 0x167bf10
#25 0x00000000005640a6 in read_key_sequence (keybuf=0x7fffffffe520, bufsize=30, prompt=0, dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9054
        interrupted_kboard = 0x167bf10
        interrupted_frame = 0x12d8680
        key = 27648
        used_mouse_menu = false
        echo_local_start = 0
        last_real_key_start = 0
        keys_local_start = 0
        new_binding = 140737488348384
        count = 2
        t = 0
        echo_start = 0
        keys_start = 0
        current_binding = 40660771
        first_event = 0
        first_unbound = 31
        mock_input = 0
        fkey = {
          parent = 17484467, 
          map = 17484467, 
          start = 0, 
          end = 0
        }
        keytran = {
          parent = 13295171, 
          map = 13295171, 
          start = 0, 
          end = 0
        }
        indec = {
          parent = 17484483, 
          map = 17484483, 
          start = 0, 
          end = 0
        }
        shift_translated = false
        delayed_switch_frame = 0
        original_uppercase = 5552513
        original_uppercase_position = -1
        dummyflag = false
        starting_buffer = 0xf29c30
        fake_prefixed_keys = 0
#26 0x000000000055455d in command_loop_1 () at keyboard.c:1357
        cmd = 40651341
        keybuf = {268435702, 268435702, 140737488348512, 6102489, 12866576, 0, 5556720, 0, 140737488348608, 6104765, 0, 28656, 0, 28656, 13028656, 6099123, 0, 140737488348608, 5552513, 0, 140737488348704, 6227505, 13504947, 
          2, 13028656, 6226506, 0, 140737488348688, 5552513, 0}
        i = 1
        prev_modiff = 1424
        prev_buffer = 0xf29c30
        already_adjusted = false
#27 0x00000000005ebd00 in internal_condition_case (bfun=0x554153 <command_loop_1>, handlers=19296, hfun=0x55393d <cmd_error>) at eval.c:1310
        val = 5552513
        c = 0x155d810
#28 0x0000000000553e5a in command_loop_2 (ignore=0) at keyboard.c:1099
        val = 0
#29 0x00000000005eb620 in internal_catch (tag=46128, func=0x553e31 <command_loop_2>, arg=0) at eval.c:1075
        val = 5552513
        c = 0x155d6e0
#30 0x0000000000553dfc in command_loop () at keyboard.c:1078
No locals.
#31 0x0000000000553505 in recursive_edit_1 () at keyboard.c:684
        count = 1
        val = 140737488349088
#32 0x0000000000553699 in Frecursive_edit () at keyboard.c:755
        count = 0
        buffer = 0
#33 0x000000000055153f in main (argc=3, argv=0x7fffffffe9b8) at emacs.c:1617
        dummy = 0
        stack_bottom_variable = 0 '\000'
        do_initial_setlocale = true
        dumping = false
        skip_args = 0
        rlim = {
          rlim_cur = 8720000, 
          rlim_max = 18446744073709551615
        }
        no_loadup = false
        junk = 0x0
        dname_arg = 0x0
        ch_to_dir = 0x0
        original_pwd = 0x0

Lisp Backtrace:
"redisplay_internal (C function)" (0x0)

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

* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
  2016-04-10 15:33   ` Matthew Leach
@ 2016-04-10 16:24     ` Eli Zaretskii
  2016-04-10 16:36       ` Matthew Leach
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-04-10 16:24 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 23259

> From: Matthew Leach <matthew@mattleach.net>
> Cc: 23259@debbugs.gnu.org
> Date: Sun, 10 Apr 2016 16:33:17 +0100
> 
> Maybe limit the zoom before X would crash?  Presumably X has an upper
> bound on how large it can render things since it can yield a BadLength
> error.  However, I've never studied X before.

I think we can use the display dimensions instead: it makes little
sense to make the font larger than that.

> >   . what is the maximum value of the scale factor you see on the mode
> >     line before Emacs crashes
> 
> I can get to about +34 before it crashes.
> 
> >   . what is the value returned by display-pixel-width
> 
> (display-pixel-width) => 1366
> 
> >   . what is the values returned by frame-char-width and
> >     frame-char-height
> 
> (frame-char-width) => 9
> (frame-char-height) => 18

Thanks.  Please try the patch below.  It should also avoid similar
crashes when you repeatedly press C-- to decrease the font.

--- lisp/face-remap.el~0	2016-01-03 06:46:29.000000000 +0200
+++ lisp/face-remap.el	2016-04-10 16:03:57.601223100 +0300
@@ -256,6 +256,14 @@
 						text-scale-mode-amount))))
   (force-window-update (current-buffer)))
 
+(defun text-scale-min-amount ()
+  "Return the minimum amount of text-scaling we allow."
+  (log (/ 1.0 (frame-char-height)) text-scale-mode-step))
+
+(defun text-scale-max-amount ()
+  "Return the maximum amount of text-scaling we allow."
+  (log (/ (min (display-pixel-width) #xffff) (frame-char-width)) text-scale-mode-step))
+
 ;;;###autoload
 (defun text-scale-set (level)
   "Set the scale factor of the default face in the current buffer to LEVEL.
@@ -266,7 +274,8 @@
 `text-scale-mode-step' (a negative number decreases the height by
 the same amount)."
   (interactive "p")
-  (setq text-scale-mode-amount level)
+  (setq text-scale-mode-amount
+        (max (min level (text-scale-max-amount)) (text-scale-min-amount)))
   (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
 
 ;;;###autoload
@@ -279,8 +288,13 @@
 height by the same amount).  As a special case, an argument of 0
 will remove any scaling currently active."
   (interactive "p")
-  (setq text-scale-mode-amount
-	(if (= inc 0) 0 (+ (if text-scale-mode text-scale-mode-amount 0) inc)))
+  (let* ((current-value (if text-scale-mode text-scale-mode-amount 0))
+         (new-value (if (= inc 0) 0 (+ current-value inc))))
+    (if (or (> new-value (text-scale-max-amount))
+            (< new-value (text-scale-min-amount)))
+        (user-error "Cannot %s the default face height more than it already is"
+                    (if (> inc 0) "increase" "decrease")))
+    (setq text-scale-mode-amount new-value))
   (text-scale-mode (if (zerop text-scale-mode-amount) -1 1)))
 
 ;;;###autoload





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

* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
  2016-04-10 16:24     ` Eli Zaretskii
@ 2016-04-10 16:36       ` Matthew Leach
  2016-04-10 16:52         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Leach @ 2016-04-10 16:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 23259

Hi Eli,

Eli Zaretskii <eliz@gnu.org> writes:

[...]

> Thanks.  Please try the patch below.  It should also avoid similar
> crashes when you repeatedly press C-- to decrease the font.

Great - that fixes this for me.

Thanks,
-- 
Matt





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

* bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault
  2016-04-10 16:36       ` Matthew Leach
@ 2016-04-10 16:52         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2016-04-10 16:52 UTC (permalink / raw)
  To: Matthew Leach; +Cc: 23259-done

> From: Matthew Leach <matthew@mattleach.net>
> Cc: 23259@debbugs.gnu.org
> Date: Sun, 10 Apr 2016 17:36:22 +0100
> 
> > Thanks.  Please try the patch below.  It should also avoid similar
> > crashes when you repeatedly press C-- to decrease the font.
> 
> Great - that fixes this for me.

Thanks, pushed.





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

end of thread, other threads:[~2016-04-10 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 10:49 bug#23259: 25.1.50; Xerror: "BadLength" on extreme zoom causing emacs to segfault Matthew Leach
2016-04-10 15:01 ` Eli Zaretskii
2016-04-10 15:33   ` Matthew Leach
2016-04-10 16:24     ` Eli Zaretskii
2016-04-10 16:36       ` Matthew Leach
2016-04-10 16:52         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.