Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPubs-0007kj-1H for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Oct 2019 20:30:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iPubq-0000Ka-OK for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Oct 2019 20:30:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iPubq-0000KS-8H for pgsql-bugs@lists.postgresql.org; Wed, 30 Oct 2019 20:30:26 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iPubj-00045b-5j for pgsql-bugs@lists.postgresql.org; Wed, 30 Oct 2019 20:30:24 +0000 Received: by mail-qt1-x843.google.com with SMTP id c26so5132605qtj.10 for ; Wed, 30 Oct 2019 13:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=clnkPUwtoPAkoAei1hHqolG1Epb7hYDXGTm//mNJu1I=; b=l+WQXKnntY05bWs4RTlT8+DHQftPCmOx42eWB02jW5YHC73rmMZh+PvMt1eH8iU20x ugs87zqe2m4rLOC9ICU/TVWOL9FT6x4ptYAFjU0az6vPFwydTW/l2zCue6UynlC6Gsp0 NcKwkOstbpqT7TsQzlkUCKs0/cGpIP7gkKGz6ssMsQP8vlFnQMgW1/GaAjoZvla8iK/e WqR/FvbVFWzMfAIoMwJkM4yzyM8RQwsI6uJIABpSCUiOxr7tznAQ0hb71m/7W7kiiahE hoxEu7/MqlifrMFx52pBUkdbVpkdDeySMtAoo2u6yuCIbBCAHilfZrGya8t4GB9kW8cM D0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=clnkPUwtoPAkoAei1hHqolG1Epb7hYDXGTm//mNJu1I=; b=pT5XXtbAU1W3FYAyO46PZLl9sIzVmujQz71ZlFdD2MommBTQ6bo0+HD9iis5KucY8+ +YAumQcVHXWOtVaWY7vRzW4qYrlRK8qPW4YRZ3rgJ74IUAR3fyshcLrdOaevZCOVnecg bidCdLv2g/doSpck1o1vqeGeibOEBTeKe2YOc0ZYX5kP4uYE5A95jtPqov9YZ7Xa7l7o sBrbQKbb1znqBC1kqhv5LBOccmslgc8QCb0rod8YaOM/iYZL2ynGDo3ppgXOK/4rhFjF TfNxz4x6tfv7AwZn/wPCkC9JAviaj1KDODD7Ol1Ld6CP5SZ/FLP2zSvV3oJ3QYoagr4k QX+Q== X-Gm-Message-State: APjAAAXs9I6pkJDjXc5derSDyrg0zr2ogqS/61VD7cs6iLM9VC9KBeQ1 0PybDW0DiiqqaesvBZk+CDXyuA== X-Google-Smtp-Source: APXvYqwpBBvw49dTPkg8sfB5KBUZ4jKHCPj9G2SyWwbk5SB9c4lx0Pp+U2dvNf6T5YwqRoiM+73zQg== X-Received: by 2002:ac8:434a:: with SMTP id a10mr2084680qtn.263.1572467417943; Wed, 30 Oct 2019 13:30:17 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id s123sm635073qke.31.2019.10.30.13.30.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 13:30:17 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D1348300A9F; Wed, 30 Oct 2019 17:30:14 -0300 (-03) Date: Wed, 30 Oct 2019 17:30:14 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: cilizili@protonmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16082: TOAST's pglz_decompress access to uninitialized data, if the database is corrupted. Message-ID: <20191030203014.GA5452@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191026215646.5e2brazqzboxclf4@development> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Oct-26, Tomas Vondra wrote: > On Sat, Oct 26, 2019 at 07:46:25AM +0000, PG Bug reporting form wrote: > > There is two case that they are valid for invalid data. In the case 1, it > > reads an uninitialized data in the dest. In the case 2, it reads > > uninitialized or out-of-bound data in the dest. They are invalid. > Well, failure like this after reading corrupted data from disk is not > really surprising and it's hardly a bug. It's kinda intended to work > that way, really. There's some weight to the argument that the server should just crash but instead report an ERRCODE_DATA_CORRUPTED message, such as what happens with (say) invalid page headers. It would probably require a lot more branches in the detoasting code that might decrease performance, though. A patch would help to see how bad that would be, though offhand I would expect it to be very bad. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services