From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: image size limit? Date: Sat, 15 Oct 2005 14:33:57 -0400 Message-ID: <87oe5qiq96.fsf@stupidchicken.com> References: <87oe5v7q19.fsf@stupidchicken.com> <87k6giiqh3.fsf@pacem.orebokech.com> <87fyr4w8sh.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129401288 19791 80.91.229.2 (15 Oct 2005 18:34:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Oct 2005 18:34:48 +0000 (UTC) Cc: romain@orebokech.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 15 20:34:46 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQqrD-0007J8-1e for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 20:34:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQqrC-00055Y-B4 for ged-emacs-devel@m.gmane.org; Sat, 15 Oct 2005 14:34:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQqr1-00055T-Nw for emacs-devel@gnu.org; Sat, 15 Oct 2005 14:33:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQqr0-00055C-CS for emacs-devel@gnu.org; Sat, 15 Oct 2005 14:33:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQqr0-000559-5c for emacs-devel@gnu.org; Sat, 15 Oct 2005 14:33:58 -0400 Original-Received: from [18.95.6.43] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EQqqz-0000iK-LB; Sat, 15 Oct 2005 14:33:57 -0400 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 800581E42D5; Sat, 15 Oct 2005 14:33:57 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Sat, 15 Oct 2005 12:13:14 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:44089 Archived-At: > At the same time, we implement image width and height limits in > x_create_x_image_and_pixmap, to deal with malicious images that > specify gigantic width and height sizes, even though the file size > isn't that big. > > Will that succeed in handling the problem case we got? It will avoid allocating too much memory in Emacs. Whether libungif tries to allocate too much memory prior to this, depends on the internal implementation of libungif. Worst that could happen is that libungif believes the invalid width and height data, tries to malloc a big chunk of memory, malloc fails, and DGifSlurp() frees the memory and returns with an error, which we catch. I can't find any libungif function for controlling how much memory libungif uses. As for libpng, the png_set_user_limits() function was only added in version 1.0.16rc1, from 2004, so if we use that we'll lose compatibility with older versions. I don't think it's worth delaying the release for this.