Subject: bug#1371: 23.0.60; Crash in print_object

From: Markus Triska <[email-masked]>
Date: Wed, 19 Nov 2008 01:40:21 +0100 (CET)

With crash9.txt from

   http://www.logic.at/prolog/crash9.txt

"$ emacs -Q crash9.txt" results in a crash with this backtrace:

   mt-computer:~ mt$ gdb emacs
   GNU gdb 6.3.50-20050815 (Apple version gdb-573) (Fri Oct 20 15:50:43 GMT 2006)
   Copyright 2004 Free Software Foundation, Inc.
   GDB is free software, covered by the GNU General Public License, and you are
   welcome to change it and/or distribute copies of it under certain conditions.
   Type "show copying" to see the conditions.
   There is absolutely no warranty for GDB.  Type "show warranty" for details.
   This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .................................... done

   (gdb) r -Q crash9.txt 
   Starting program: /usr/local/bin/emacs -Q crash9.txt
   Reading symbols for shared libraries ....................................................................+++..+.++.+..++.+.+++++++++++++.++++.....+++ done
   Reading symbols for shared libraries . done

   Program received signal EXC_BAD_ACCESS, Could not access memory.
   Reason: KERN_PROTECTION_FAILURE at address: 0x00000004
   0x0016c12e in print_object (obj=1, printcharfun=58721337, escapeflag=1) at print.c:1731
   1731            register unsigned char *p = SDATA (SYMBOL_NAME (obj));
   (gdb) bt
   #0  0x0016c12e in print_object (obj=1, printcharfun=58721337, escapeflag=1) at print.c:1731
   #1  0x0016f403 in Fprin1 (object=1, printcharfun=58721337) at print.c:750
   #2  0x0016fa64 in print_error_message (data=40328069, stream=58721337, context=0xbffff62e "", caller=58832209) at print.c:1105
   #3  0x000e9516 in cmd_error_internal (data=40328069, context=0xbffff62e "") at keyboard.c:1283
   #4  0x000e964c in cmd_error (data=40328069) at keyboard.c:1222
   #5  0x001503d4 in internal_condition_case (bfun=0xe2908 <top_level_2>, handlers=58760953, hfun=0xe956d <cmd_error>) at eval.c:1501
   #6  0x000e296c in top_level_1 () at keyboard.c:1355
   #7  0x00150072 in internal_catch (tag=58757025, func=0xe292a <top_level_1>, arg=58721289) at eval.c:1247
   #8  0x000e2687 in command_loop () at keyboard.c:1310
   #9  0x000e2757 in recursive_edit_1 () at keyboard.c:942
   #10 0x000e289f in Frecursive_edit () at keyboard.c:1004
   #11 0x000e16f4 in main (argc=3, argv=0xbffffa04) at emacs.c:1777
   (gdb) bt full
   #0  0x0016c12e in print_object (obj=1, printcharfun=58721337, escapeflag=1) at print.c:1731
           end = (unsigned char *) 0x0
           c = 0
           i_byte = 224
           confusing = 58828968
           p = (unsigned char *) 0x1 <Address 0x1 out of bounds>
           size_byte = 1085932
           buf = "\002\000\000\000\000\000\000\000u?\001\000??3\000?I\023\002??????\001\000\001\000\000\0009\004?\003\001\000\000"
   #1  0x0016f403 in Fprin1 (object=1, printcharfun=58721337) at print.c:750
           old = (struct buffer *) 0x3101678
           old_point = -1
           start_point = -1
           old_point_byte = -1
           start_point_byte = -1
           free_print_buffer = 0
           multibyte = 1
   #2  0x0016fa64 in print_error_message (data=40328069, stream=58721337, context=0xbffff62e "", caller=58832209) at print.c:1105
           obj = 1491231
           errname = 58761001
           errmsg = 58803451
           file_error = 58721289
           tail = 40328040
           i = 1
           data = 1
           context = 0x16c11f "????????????????G\004?????\b????P\f?p\004??\017?g\t"
           caller = 40328040
   #3  0x000e9516 in cmd_error_internal (data=40328069, context=0xbffff62e "") at keyboard.c:1283
   No locals.
   #4  0x000e964c in cmd_error (data=40328069) at keyboard.c:1222
           old_level = 58721289
           old_length = 58721289
           macroerror = "\000?\000\000\000\000\000\0004\000\t\004?\003?(?\004?\026\000?\020\030\020\001`H?\024)\016\000094\000`84\000x???$)\016"
           data = 1491231
   #5  0x001503d4 in internal_condition_case (bfun=0xe2908 <top_level_2>, handlers=58760953, hfun=0xe956d <cmd_error>) at eval.c:1501
           val = 1
           c = {
     tag = 58721289, 
     val = 40328069, 
     next = 0xbffff77c, 
     gcpro = 0x0, 
     jmp = {-1073806465, -1881124082, 8096, 1377071, -1880799136, 1610981, 3401152, 3378832, -1073744072, -1073744256, 31, 658, 1377220, 1310743, 3342367, 3342367, -1073807360, -1881079753}, 
     backlist = 0x0, 
     handlerlist = 0x0, 
     lisp_eval_depth = 0, 
     pdlcount = 2, 
     poll_suppress_count = 1, 
     interrupt_input_blocked = 0, 
     byte_stack = 0x0
   }
           h = {
     handler = 58760953, 
     var = 58721289, 
     chosen_clause = 58721337, 
     tag = 0xbffff698, 
     next = 0x0
   }
   #6  0x000e296c in top_level_1 () at keyboard.c:1355
   No locals.
   #7  0x00150072 in internal_catch (tag=58757025, func=0xe292a <top_level_1>, arg=58721289) at eval.c:1247
           c = {
     tag = 58757025, 
     val = 58721289, 
     next = 0x0, 
     gcpro = 0x0, 
     jmp = {895, 15, 8096, 1376214, 2, 18199, 3401152, 3378832, -1073743880, -1073744032, 58851359, 662, 1376357, 58851351, 58851359, 58720287, 51380224, 55}, 
     backlist = 0x0, 
     handlerlist = 0x0, 
     lisp_eval_depth = 0, 
     pdlcount = 2, 
     poll_suppress_count = 1, 
     interrupt_input_blocked = 0, 
     byte_stack = 0x0
   }
           tag = 1491231
   #8  0x000e2687 in command_loop () at keyboard.c:1310
           val = 1491231
   #9  0x000e2757 in recursive_edit_1 () at keyboard.c:942
           val = 0
   #10 0x000e289f in Frecursive_edit () at keyboard.c:1004
           buffer = 58721289
   #11 0x000e16f4 in main (argc=3, argv=0xbffffa04) at emacs.c:1777
           dummy = 0
           stack_bottom_variable = 0 '\0'
           do_initial_setlocale = 1
           skip_args = 0
           rlim = {
     rlim_cur = 8388608, 
     rlim_max = 67108864
   }
           no_loadup = 0
           junk = 0x0
           dname_arg = 0x0
   (gdb) 

In GNU Emacs 23.0.60.2 (i386-apple-darwin8.11.1, GTK+ Version 2.12.9)
 of 2008-11-05 on mt-computer.local
Windowing system distributor `The XFree86 Project, Inc', version 11.0.40400000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t