From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#36773: 27.0.50; Accessing a cached SVG with eww can cause Emacs to crash Date: Thu, 25 Jul 2019 12:05:10 +0000 Message-ID: References: <83zhl3o5gf.fsf@gnu.org> <83sgqvnt87.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="7851"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36773@debbugs.gnu.org To: Adam Plaice Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 25 14:06:08 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hqcVc-0001mu-DA for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Jul 2019 14:06:08 +0200 Original-Received: from localhost ([::1]:59532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqcVb-0002Xn-9S for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Jul 2019 08:06:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58166) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqcVX-0002XJ-OC for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2019 08:06:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqcVW-0003L3-Hy for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2019 08:06:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hqcVW-0003Kz-Eg for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2019 08:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hqcVW-000279-6c for bug-gnu-emacs@gnu.org; Thu, 25 Jul 2019 08:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 Jul 2019 12:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36773 X-GNU-PR-Package: emacs Original-Received: via spool by 36773-submit@debbugs.gnu.org id=B36773.15640563558114 (code B ref 36773); Thu, 25 Jul 2019 12:06:02 +0000 Original-Received: (at 36773) by debbugs.gnu.org; 25 Jul 2019 12:05:55 +0000 Original-Received: from localhost ([127.0.0.1]:38474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqcVO-00026o-Lp for submit@debbugs.gnu.org; Thu, 25 Jul 2019 08:05:54 -0400 Original-Received: from mail-oi1-f176.google.com ([209.85.167.176]:41791) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hqcVL-00026Z-Le for 36773@debbugs.gnu.org; Thu, 25 Jul 2019 08:05:52 -0400 Original-Received: by mail-oi1-f176.google.com with SMTP id g7so37461410oia.8 for <36773@debbugs.gnu.org>; Thu, 25 Jul 2019 05:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fTuqEOReVdtr6/zPCjokvLqKKoXrdGvLJTTEhch6J0s=; b=br+JlcqZ6lhjtTJLT1GITNyHAaRylV/xrg4bjdxBK4CgXbWowV9vSsGCBUjcp2Rtjz PpisVfhZKYURCFyGiiovPcfxb9QZ7yNHcpP1a8YT/MgmoyqXo4oBsutOokEMrmgDD3ls LN/OwRyYfpWj3csGKEYz78vFxoECwvk4chc5JiYdbOzDtMFOw4Zq/UDEEtNrNR8oT8+O 2RdnVUCkoRYvG0tJmHJdgPCi7NVR4lAORp0tibSoGMULFCdnE806IGsKikYy+dLczMhs rxLlIYZGiOR497VpGk4FTI3xrh4GfbR3fJkMcPblT4hMYh04sZf5GqSI+jozqYvrHrOE qi0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fTuqEOReVdtr6/zPCjokvLqKKoXrdGvLJTTEhch6J0s=; b=NznRGY+kywf0Q4MSR2DRLVFx6V8YKGXn6aKZzlZ+jg4d+zbSEIWVJL6gC06YRpe6EO bXw9HOWV/WOyMKUYpIp/byfYB+MCYnW3+69EQy97+yxfE+z2PKEQw0OogFF7JmxmRdzt jyZpWLkJTpmITlAvB7D39AeVbame39T79bEL3Xj4B8rSuaTE8wqdJf3ozE3CUbe4MtNg pMZikxXLu3T8/HszQqaL0ZpmazgSXg+ljDaGw/+ahKLcxrBC4rzf10tsV5BZ4/6u7W4l OAhNCgIN/+0+IPn2zXlJ04qqZaH1rKJV+pAbIWfkzhnEl72Bk3ksrcdiwzATzDx4KIvy UFNQ== X-Gm-Message-State: APjAAAWtTwIkA3M4Il8cA5nHTk5wIaN8OkY95jDNhAU0JsP4GIQqK3M0 GNwmFLvv3oBWrFBaCSowVFSZidkQxs0opWYuABc= X-Google-Smtp-Source: APXvYqyTZOqMGdJjm0MBHDKu1Hk3GNPy5jrNdEGcFBGGpoPHaRN7m+IvDSiURobTV44Qo4p/VODuFr44y63MYYUJ4vo= X-Received: by 2002:aca:2303:: with SMTP id e3mr38580318oie.112.1564056346165; Thu, 25 Jul 2019 05:05:46 -0700 (PDT) In-Reply-To: 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: 209.51.188.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:163696 Archived-At: On Wed, Jul 24, 2019 at 10:13 PM Adam Plaice wrote: > > I'm attaching a patch to fix the rsvg segfault, and another patch > > which works around the url-http issue. However, I'm not sure how the > > latter should be fixed properly. > > Thanks! The first patch indeed prevents the crash, while the second also > causes the image to be displayed (as expected). Thank you for testing. > > - (zlib-decompress-region (point) (point-max))))))) > > + (zlib-decompress-region (point) (point-max) t)))))) > > > So I guess that is a hint, we could just go back to the Emacs-26 > > behavior. I don't think we should, but in practice it should work > > okay. > > b36913d803ee22a314f2e0a27523fbadeb60dd2c introduced the above change. > Testing with a checkout of it, results in a blank "standard error box" > being displayed, though interestingly without a crash. At > b36913d803ee22a314f^ the SVG was correctly displayed, so > b36913d803ee22a314f did indeed introduce (part of) this bug. However, > not using ALLOW-PARTIAL, would re-introduce Bug#33133, which would > probably not be a great idea. Agreed. As I said, I think it's best to remove the content-encoding header when interpreting it. > > I thought that additional argument only mattered upon failure to > > completely uncompress the data. Otherwise, the use of that argument > > should not have changed the behavior. Are you saying that the > > decompression failed in this case? If not, what am I missing? > > If I understand the issue correctly, it's because > `zlib-decompress-region' is trying to decompress content that is in > the cache and had already been decompressed. That's my understanding as well. > Hence, the decompression > fails and deletes the contents, which, depending on other particulars, > either crashes Emacs or causes a warning, and in any case prevents the > actual image from being displayed. I don't think "allow-partial" properly expresses the "and delete the specified region unconditionally" semantics we now have. It might make more sense to replace the region only if at least one byte of data was successfully decompressed.