From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#27779: #27779; C stack overflow from `read' on deeply nested lisp object. Date: Mon, 08 Jan 2018 17:38:27 -0800 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Mon_Jan__8_17:38:27_2018-1" X-Trace: blaine.gmane.org 1515461839 1802 195.159.176.226 (9 Jan 2018 01:37:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Jan 2018 01:37:19 +0000 (UTC) Cc: 27779@debbugs.gnu.org To: Noam Postavsky , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 09 02:37:15 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYiqj-0008Hd-TC for geb-bug-gnu-emacs@m.gmane.org; Tue, 09 Jan 2018 02:37:10 +0100 Original-Received: from localhost ([::1]:44730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYisj-00056P-I2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Jan 2018 20:39:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYisc-000564-8w for bug-gnu-emacs@gnu.org; Mon, 08 Jan 2018 20:39:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYisZ-0001fW-5m for bug-gnu-emacs@gnu.org; Mon, 08 Jan 2018 20:39:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33252) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYisY-0001f6-Pr for bug-gnu-emacs@gnu.org; Mon, 08 Jan 2018 20:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eYisY-0005kB-Jd for bug-gnu-emacs@gnu.org; Mon, 08 Jan 2018 20:39:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Jan 2018 01:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27779 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 27779-submit@debbugs.gnu.org id=B27779.151546191222017 (code B ref 27779); Tue, 09 Jan 2018 01:39:02 +0000 Original-Received: (at 27779) by debbugs.gnu.org; 9 Jan 2018 01:38:32 +0000 Original-Received: from localhost ([127.0.0.1]:41928 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYis4-0005j3-LE for submit@debbugs.gnu.org; Mon, 08 Jan 2018 20:38:32 -0500 Original-Received: from gateway30.websitewelcome.com ([50.116.126.1]:49877) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYis1-0005iu-VK for 27779@debbugs.gnu.org; Mon, 08 Jan 2018 20:38:30 -0500 Original-Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 5C582513B for <27779@debbugs.gnu.org>; Mon, 8 Jan 2018 19:38:29 -0600 (CST) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Yis0eRhYhvkfxYis1ezqix; Mon, 08 Jan 2018 19:38:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cBdiQ8ppofnqobTKyi8VOVTnbG7XFpbVhKOQjLg7y38=; b=Dqflcxe6S8BhOzWvD1msgYuIQt RTkAkm1bNlktJ20BgupkvFqFXHLwLJDci5Ex8HyM3eVPfoFpHOBcmKccwB3NS1j9g+ot4WvheaSWs omv4aTYDG3qj6o5Q7kPMs8Us+IsLVtPJ1LEJcTkuM7M6jEgQ9qJcTsSGSvXWyeK7VIQXbAYD1y/67 fWkXzA/DKxnlcXzaANkeoMouxwz87k4nvj8oVxvSv7caTykrOxXGpCR+Y82S+TL9WV+lXeiiRLdWR 3inFvMQ0pj2IlAn5te0Ejosw1WVPJdZ+81iSnmBIRICaOXOBx68O9qw54711l9ZHOrgEB1hx8FZCh 7ogRip/g==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:54556 helo=server.private) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89) (envelope-from ) id 1eYis0-003Chk-85; Mon, 08 Jan 2018 19:38:28 -0600 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1eYis0-003Chk-85 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.private) [45.48.239.195]:54556 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141915 Archived-At: --Multipart_Mon_Jan__8_17:38:27_2018-1 Content-Type: text/plain; charset=US-ASCII Dear Paul and Noam: I have determined that bug #27779 was introduced on December 8, 2016 with commit f0a1e9ec3fba3d5bea5bd62f525dba3fb005d1b1. The following patch to the Emacs 26 branch as of today (01/08/2018) reverses the commit and enables the test below to be completed successfully. [FYI: I am on OSX 10.6.8 and am manually increasing the stack limit with `ulimit -S -s unlimited` so that I can have rather large custom undo-tree histories.] (require 'cl-lib) (defun make-deep-object (depth) (let ((obj 1)) (while (> (cl-decf depth) 0) (setq obj (vector (list obj)))) obj)) ;;; STACK OVERFLOW: problem with `read' ;;; The bug was introduced on December 8, 2016 with ;;; commit: f0a1e9ec3fba3d5bea5bd62f525dba3fb005d1b1 (let* ((print-circle t) (max-lisp-eval-depth most-positive-fixnum) (max-specpdl-size most-positive-fixnum) (deep-object (make-deep-object 6000)) (string (prin1-to-string deep-object)) (result (read string))) (when result (message "Bug #27779: Success! (%d)" (length string)))) --Multipart_Mon_Jan__8_17:38:27_2018-1 Content-Type: application/diff; type=patch Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9scmVhZC5jIGIvc3JjL2xyZWFkLmMKaW5kZXggNDVkNjA2NC4uMTIx OTA3NyAxMDA2NDQKLS0tIGEvc3JjL2xyZWFkLmMKKysrIGIvc3Jj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IT0gTk9fQlJFQUtfU1BBQ0UKLQkgICAgICAgJiYgKGMgPj0gMDIwMAotCQkgICB8fCBzdHJjaHIg KCJcIic7KClbXSNgLCIsIGMpID09IE5VTEwpKTsKKwkgICAgICBpZiAobXVsdGlieXRlKQorCQlw ICs9IENIQVJfU1RSSU5HIChjLCAodW5zaWduZWQgY2hhciAqKSBwKTsKKwkgICAgICBlbHNlCisJ CSpwKysgPSBjOworCSAgICAgIGMgPSBSRUFEQ0hBUjsKKwkgICAgfQorCSAgd2hpbGUgKGMgPiAw NDAKKwkJICYmIGMgIT0gTk9fQlJFQUtfU1BBQ0UKKwkJICYmIChjID49IDAyMDAKKwkJICAgICB8 fCBzdHJjaHIgKCJcIic7KClbXSNgLCIsIGMpID09IE5VTEwpKTsKIAotCSpwID0gMDsKLQlVTlJF QUQgKGMpOworCSAgaWYgKHAgPT0gZW5kKQorCSAgICB7CisJICAgICAgcHRyZGlmZl90IG9mZnNl dCA9IHAgLSByZWFkX2J1ZmZlcjsKKwkgICAgICBncm93X3JlYWRfYnVmZmVyICgpOworCSAgICAg IHAgPSByZWFkX2J1ZmZlciArIG9mZnNldDsKKwkgICAgICBlbmQgPSByZWFkX2J1ZmZlciArIHJl YWRfYnVmZmVyX3NpemU7CisJICAgIH0KKwkgICpwID0gMDsKKwkgIFVOUkVBRCAoYyk7CisJfQog CiAJaWYgKCFxdW90ZWQgJiYgIXVuaW50ZXJuZWRfc3ltYm9sKQogCSAgewogCSAgICBMaXNwX09i amVjdCByZXN1bHQgPSBzdHJpbmdfdG9fbnVtYmVyIChyZWFkX2J1ZmZlciwgMTAsIDApOwogCSAg ICBpZiAoISBOSUxQIChyZXN1bHQpKQotCSAgICAgIHJldHVybiB1bmJpbmRfdG8gKGNvdW50LCBy ZXN1bHQpOworCSAgICAgIHJldHVybiByZXN1bHQ7CiAJICB9CiAgICAgICAgIGlmICghcXVvdGVk ICYmIG11bHRpYnl0ZSkKICAgICAgICAgICB7CkBAIC0zNDk4LDQ5IC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