From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#18410: Use SAFE_ALLOCA etc. to avoid unbounded stack allocation. Date: Thu, 04 Sep 2014 23:08:43 -0700 Organization: UCLA Computer Science Department Message-ID: <5409536B.5090201@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070202020006090104060805" X-Trace: ger.gmane.org 1409897434 20819 80.91.229.3 (5 Sep 2014 06:10:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Sep 2014 06:10:34 +0000 (UTC) To: 18410@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 05 08:10:26 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XPmj2-0008MO-Cm for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Sep 2014 08:10:25 +0200 Original-Received: from localhost ([::1]:55597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmj1-0004Bl-HQ for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Sep 2014 02:10:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmip-00041W-Hf for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:10:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPmih-0007d4-7L for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:10:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39416) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmih-0007cm-2j for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XPmig-0000mg-DL for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Sep 2014 06:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18410 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Emacs bug reports and feature requests Original-Received: via spool by submit@debbugs.gnu.org id=B.14098973642953 (code B ref -1); Fri, 05 Sep 2014 06:10:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Sep 2014 06:09:24 +0000 Original-Received: from localhost ([127.0.0.1]:59214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPmi2-0000lY-No for submit@debbugs.gnu.org; Fri, 05 Sep 2014 02:09:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47179) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XPmi0-0000lL-2n for submit@debbugs.gnu.org; Fri, 05 Sep 2014 02:09:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPmhn-00076r-Ly for submit@debbugs.gnu.org; Fri, 05 Sep 2014 02:09:14 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmhn-00076n-HO for submit@debbugs.gnu.org; Fri, 05 Sep 2014 02:09:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmhe-0003pX-TT for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPmhW-000762-Id for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:08:58 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:48902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPmhV-00075i-SY for bug-gnu-emacs@gnu.org; Fri, 05 Sep 2014 02:08:50 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7F4E0A6000E for ; Thu, 4 Sep 2014 23:08:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CM1yr-2IVCRx for ; Thu, 4 Sep 2014 23:08:43 -0700 (PDT) Original-Received: from [192.168.1.9] (pool-71-177-17-123.lsanca.dsl-w.verizon.net [71.177.17.123]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id AAD88A60003 for ; Thu, 4 Sep 2014 23:08:43 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93054 Archived-At: This is a multi-part message in MIME format. --------------070202020006090104060805 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Tags: patch Attached is a patch to fix the unbounded alloca calls that I found when auditing the Emacs source. I'm sending this to bug-gnu-emacs to give Eli a heads-up, as some of the fixes affect Windows code. This patch is relative to Emacs trunk bzr 117822. --------------070202020006090104060805 Content-Type: text/plain; charset=UTF-8; name="alloca.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="alloca.patch" PT09IG1vZGlmaWVkIGZpbGUgJ3NyYy9DaGFuZ2VMb2cnCi0tLSBzcmMvQ2hhbmdlTG9nCTIw MTQtMDktMDQgMDU6Mzg6MzcgKzAwMDAKKysrIHNyYy9DaGFuZ2VMb2cJMjAxNC0wOS0wNSAw NjowMzoyOCArMDAwMApAQCAtMSwzICsxLDEwMSBAQAorMjAxNC0wOS0wNSAgUGF1bCBFZ2dl cnQgIDxlZ2dlcnRAY3MudWNsYS5lZHU+CisKKwlVc2UgU0FGRV9BTExPQ0EgZXRjLiB0byBh dm9pZCB1bmJvdW5kZWQgc3RhY2sgYWxsb2NhdGlvbi4KKwlUaGlzIGZvbGxvd3MgdXAgb24g dGhlIHJlY2VudCB0aHJlYWQgaW4gZW1hY3MtZGV2ZWwgb24gYWxsb2NhOyBzZWU6CisJaHR0 cDovL2xpc3RzLmdudS5vcmcvYXJjaGl2ZS9odG1sL2VtYWNzLWRldmVsLzIwMTQtMDkvbXNn MDAwNDIuaHRtbAorCVRoaXMgcGF0Y2ggYWxzbyBjbGVhbnMgdXAgYWxsb2NhLXJlbGF0ZWQg Z2xpdGNoZXMgbm90ZWQgd2hpbGUKKwlleGFtaW5pbmcgdGhlIGNvZGUgbG9va2luZyBmb3Ig dW5ib3VuZGVkIGFsbG9jYS4KKwkqIGFsbG9jLmMgKGxpc3RuKToKKwkqIGNhbGxwcm9jLmMg KGluaXRfY2FsbHByb2MpOgorC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jX2RpcmVjdG9y eSk7CisgICAgICBkaXJsZW4gPSBTQllURVMgKFZkb2NfZGlyZWN0b3J5KTsKICAgICB9CisK KyAgY291bnQgPSBTUEVDUERMX0lOREVYICgpOworICBVU0VfU0FGRV9BTExPQ0E7CisgIG5h bWUgPSBTQUZFX0FMTE9DQSAoZGlybGVuICsgU0JZVEVTIChmaWxlbmFtZSkgKyAxKTsKKyAg c3RyY3B5IChuYW1lLCBkaXJuYW1lKTsKICAgc3RyY2F0IChuYW1lLCBTU0RBVEEgKGZpbGVu YW1lKSk7IAkvKioqIEFkZCB0aGlzIGxpbmUgKioqLwogCiAgIC8qIFZidWlsZF9maWxlcyBp cyBuaWwgd2hlbiB0ZW1hY3MgaXMgcnVuLCBhbmQgbm9uLW5pbCBhZnRlciB0aGF0LiAgKi8K QEAgLTYwOCw3ICs2MTYsNiBAQAogICAgICAgcmVwb3J0X2ZpbGVfZXJybm8gKCJPcGVuaW5n IGRvYyBzdHJpbmcgZmlsZSIsIGJ1aWxkX3N0cmluZyAobmFtZSksCiAJCQkgb3Blbl9lcnJu byk7CiAgICAgfQotICBjb3VudCA9IFNQRUNQRExfSU5ERVggKCk7CiAgIHJlY29yZF91bndp bmRfcHJvdGVjdF9pbnQgKGNsb3NlX2ZpbGVfdW53aW5kLCBmZCk7CiAgIFZkb2NfZmlsZV9u YW1lID0gZmlsZW5hbWU7CiAgIGZpbGxlZCA9IDA7CkBAIC02MzcsNyArNjQ0LDcgQEAKICAg ICAgICAgICAgICAgICAgICYmIChlbmRbLTFdID09ICdvJyB8fCBlbmRbLTFdID09ICdjJykp CiAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgcHRyZGlmZl90IGxlbiA9 IGVuZCAtIHAgLSAyOwotICAgICAgICAgICAgICAgICAgY2hhciAqZnJvbWZpbGUgPSBhbGxv Y2EgKGxlbiArIDEpOworICAgICAgICAgICAgICAgICAgY2hhciAqZnJvbWZpbGUgPSBTQUZF X0FMTE9DQSAobGVuICsg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VmOwogCSAg c3ByaW50ZiAocCwgIiUicEkiZC0qIiwgdik7CiAJfQogICAgICAgZWxzZQpAQCAtMTMxNiwy MSArMTMxOCwyMiBAQAogICBlbHNlIGlmIChGTE9BVFAgKHZhbCkpCiAgICAgewogICAgICAg ZG91YmxlIHYgPSBYRkxPQVRfREFUQSAodmFsKSAqIDEwOwotICAgICAgZltYTEZEX1BJWEVM X0lOREVYXSA9IHAgPSBhbGxvY2EgKHNpemVvZiAiKi0iICsgMSArIERCTF9NQVhfMTBfRVhQ ICsgMSk7CisgICAgICBmW1hMRkRfUElYRUxfSU5ERVhdID0gcCA9IGZvbnRfc2l6ZV9pbmRl eF9idWY7CiAgICAgICBzcHJpbnRmIChwLCAiKi0lLjBmIiwgdik7CiAgICAgfQogICBlbHNl CiAgICAgZltYTEZEX1BJWEVMX0lOREVYXSA9ICIqLSoiOwogCisgIGNoYXIgZHBpX2luZGV4 X2J1ZltzaXplb2YgIi0iICsgMiAqIElOVF9TVFJMRU5fQk9VTkQgKEVNQUNTX0lOVCldOwog ICBpZiAoSU5URUdFUlAgKEFSRUYgKGZvbnQsIEZPTlRfRFBJX0lOREVYKSkpCiAgICAgewog ICAgICAgRU1BQ1NfSU5UIHYgPSBYSU5UIChBUkVGIChmb250LCBGT05UX0RQSV9JTkRFWCkp OwotICAgICAgZltYTEZEX1JFU1hfSU5ERVhdID0gcCA9Ci0JYWxsb2NhIChzaXplb2YgIi0i ICsgMiAqIElOVF9TVFJMRU5fQk9VTkQgKEVNQUNTX0lOVCkpOworICAgICAgZltYTEZEX1JF U1hfSU5ERVhdID0gcCA9IGRwaV9pbmRleF9idWY7CiAgICAgICBzcHJpbnRmIChwLCAiJSJw SSJkLSUicEkiZCIsIHYsIHYpOwogICAgIH0KICAgZWxzZQogICAgIGZbWExGRF9SRVNYX0lO REVYXSA9ICIqLSoiOworCiAgIGlmIChJTlRFR0VSUCAoQVJFRiAoZm9udCwgRk9OVF9TUEFD SU5HX0lOREVYKSkpCiAgICAg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gaTsKICAgICAgICAgICAgIC8qIFdpbmRvd3MgbW9ubyBiaXRt YXBzIGFyZSByZXZlcnNlZCBjb21wYXJlZCB3aXRoIFguICAqLwogICAgICAgICAgICAgaW52 ZXJ0ZWRCaXRzID0gYml0czsKLSAgICAgICAgICAgIG5ieXRlcyA9IChpbWctPndpZHRoICsg QklUU19QRVJfQ0hBUiAtIDEpIC8gQklUU19QRVJfQ0hBUgotICAgICAgICAgICAgICAqIGlt Zy0+aGVpZ2h0OwotICAgICAgICAgICAgYml0cyA9IGFsbG9jYSAobmJ5dGVzKTsKKyAgICAg ICAgICAgIG5ieXRlcyA9IChpbWctPndpZHRoICsgQklUU19QRVJfQ0hBUiAtIDEpIC8gQklU U19QRVJfQ0hBUjsKKyAgICAgICAgICAgIFNBRkVfTkFMTE9DQSAoYml0cywgbmJ5dGVzLCBp bWctPmhlaWdodCk7CiAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmJ5dGVzOyBpKysp CiAgICAgICAgICAgICAgIGJpdHNbaV0gPSBYQk1fQklUX1NIVUZGTEUgKGludmVydGVkQml0 c1tpXSk7CiAgICAgICAgICAgfQpAQCAtMzA4OCw2ICszMDkwLDggQEAKIAkJCSAgIGltZy0+ c3BlYywgUW5pbCk7CiAJICAgICAgeF9jbGVhcl9pbWFnZSAoZiwgaW1nKTsKIAkgICAgfQor CisJICBTQUZFX0ZSRUUgKCk7CiAJfQogICAgIH0KIApAQCAtMzQ5NCw2ICszNDk4LDggQEAK ICAgaW50IHJjOwogICBYcG1BdHRyaWJ1dGVzIGF0dHJzOwogICBMaXNwX09iamVjdCBzcGVj aWZpZWRfZmlsZSwgY29sb3Jfc3ltYm9sczsKKyAgVVNFX1NBRkVfQUxMT0NBOworCiAjaWZk ZWYgSEFWRV9OVEdVSQogICBIREMgaGRjOwogICB4cG1fWEltYWdlICogeHBtX2ltYWdlID0g TlVMTCwgKiB4cG1fbWFzayA9IE5VTEw7CkBAIC0zNTM2LDcgKzM1NDIsNy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AgICAgICAgICAgICAgICAqc3RvcmVwdHIgPSBzdHJpbmc7CisJCSAg U0FGRV9GUkVFICgpOwogICAgICAgICAgICAgICAgICAgVU5HQ1BSTzsKICAgICAgICAgICAg ICAgICAgIHJldHVybiAtMjsKIAkJfQpAQCAtMTY1MSw2ICsxNjU2LDcgQEAKICAgICAgICAg ICAgICAgICAgICAgICAvKiBXZSBzdWNjZWVkZWQ7IHJldHVybiB0aGlzIGRlc2NyaXB0b3Ig YW5kIGZpbGVuYW1lLiAgKi8KICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RvcmVwdHIp CiAgICAgICAgICAgICAgICAgICAgICAgICAqc3RvcmVwdHIgPSBzdHJpbmc7CisJCSAgICAg IFNBRkVfRlJFRSAoKTsKICAgICAgICAgICAgICAgICAgICAgICBVTkdDUFJPOwogICAgICAg ICAgICAgICAgICAgICAgIHJldHVybiBmZDsKICAgICAgICAgICAgICAgICAgICAgfQpAQCAt MTY2MSw2ICsxNjY3LDcgQEAKICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAg ICBpZiAoc3RvcmVwdHIpCiAgICAgICAgICAgICAgICAgICAgICpzdG9yZXB0ciA9IHNhdmVf c3RyaW5nOworCQkgIFNBRkVfRlJFRSAoKTsKICAgICAgICAgICAgICAgICAgIFVOR0NQUk87 CiAgICAgICAgICAgICAgICAgICByZXR1cm4gc2F2ZV9mZDsKICAgICAgICAgICAgICAgICB9 CkBAIC0xNjcwLDYgKzE2NzcsNyBAQAogCWJyZWFrOwogICAgIH0KIAorICBTQUZFX0ZSRUUg KCk7CiAgIFVOR0NQUk87CiAgIGVycm5vID0gbGFzdF9lcnJubzsKICAgcmV0dXJuIC0xOwoK PT09IG1vZGlmaWVkIGZpbGUgJ3NyYy9tZW51LmMnCi0tLSBzcmMvbWVudS5jCTIwMTQtMDgt MTAgMDg6MjY6MjggKzAwMDAKKysrIHNyYy9tZW51LmMJMjAxNC0wOS0wNSAwNjowMzoyOCAr MDAwMApAQCAt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iAgICAgICAgICAgICAgICAgICAgIGlmICghTklM UCAoc3VicHJlZml4X3N0YWNrW2pdKSkKICAgICAgICAgICAgICAgICAgICAgICBlbnRyeSA9 IEZjb25zIChzdWJwcmVmaXhfc3RhY2tbal0sIGVudHJ5KTsKICAgICAgICAgICAgICAgICB9 CisJICAgICAgU0FGRV9GUkVFICgpOwogICAgICAgICAgICAgICByZXR1cm4gZW50cnk7CiAg ICAgICAgICAgICB9CiAgICAgICAgICAgaSArPSBNRU5VX0lURU1TX0lURU1fTEVOR1RIOwog ICAgICAgICB9CiAgICAgfQorICBTQUZFX0ZSRUUgKCk7CiAgIHJldHVybiBRbmlsOwogfQog I2VuZGlmICAvKiBIQVZFX05TICovCgo9PT0gbW9kaWZpZWQgZmlsZSAnc3JjL3ByaW50LmMn Ci0tLSBzcmMvcHJpbnQuYwkyMDE0LTA3LTE3IDA5OjEyOjUxICswMDAwCisrKyBzcmMvcHJp bnQuYwkyMDE0LTA5LTA1IDA2OjAzOjI4ICswMDAwCkBAIC0xNjksMTEgKzE2OSwxMyBAQAog ICAgICAgIGlmIChwcmludF9idWZmZXJfcG9zICE9IHByaW50X2J1ZmZlcl9wb3NfYnl0ZQkJ CVwKIAkgICAmJiBOSUxQIChCVkFSIChjdXJyZW50X2J1ZmZlciwgZW5hYmxlX211bHRpYnl0 ZV9jaGFyYWN0ZXJzKSkpXAogCSB7CQkJCQkJCQlcCi0JICAgdW5zaWduZWQgY2hhciAqdGVt cCA9IGFsbG9jYSAocHJpbnRfYnVmZmVyX3BvcyArIDEpOwkJXAorCSAgIFVTRV9TQUZFX0FM TE9DQTsJCQkJCQlcCisJICAgdW5zaWduZWQgY2hhciAqdGVtcCA9IFNBRkVfQUxMT0NBIChw cmludF9idWZmZXJfcG9zICsgMSk7CVwKIAkgICBjb3B5X3RleHQgKCh1bnNpZ25lZCBjaGFy ICopIHByaW50X2J1ZmZlciwgdGVtcCwJCVwKIAkJICAgICAgcHJpbnRfYnVmZmVyX3Bvc19i eX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ICAgYnJlYWs7CiAgICAg fQogCisgcmV0dXJuX2VudHJ5OgogICB1bmJsb2NrX2lucHV0ICgpOwotICB1bmJpbmRfdG8g KHNwZWNwZGxfY291bnQsIFFuaWwpOwotCi0gIHJldHVybiBlbnRyeTsKKyAgU0FGRV9GUkVF ICgpOworICByZXR1cm4gdW5iaW5kX3RvIChzcGVjcGRsX2NvdW50LCBlbnRyeSk7CiB9CiAK ICNlbmRpZiAvKiBub3QgVVNFX1hfVE9PTEtJVCAqLwoK --------------070202020006090104060805--