Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xTDZu-00000000BwS-2k8D for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Nov 2026 07:26:07 +0000 Received: from localhost ([127.0.0.1]:38930 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xTDZt-00000003LlN-2iPw for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Nov 2026 07:26:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:60856) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xTDZt-00000003LlC-1UCh for pgsql-hackers@lists.postgresql.org; Tue, 17 Nov 2026 07:26:05 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xTDZq-000000008Dp-3agm for pgsql-hackers@lists.postgresql.org; Tue, 17 Nov 2026 07:26:05 +0000 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-cde1479f76fso223661a12.0 for ; Mon, 16 Nov 2026 23:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794900360; x=1795505160; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=MMBRZLq/TsBvn0Y94NXCqK1Bsnm45BwX3Eul3FpIPdg=; b=utXQ/e9NHhxsem62Oc3pBJj3yit9zu24hv89lp5ssBiHLvXZMaTo4wMKCoaU3kJPKp KpPw8s25BPmPc601SyJRxZSZY3u9I0dzaO0rsFF8o8fIXtExAjLe7iTooKY1KR/Zbohr CWJBrMRO9XS/5AcbTF5AjtDt4/dMnwNdNPEUatulGT+7w8CXD4bEaXlx6U06sy2BSlke L9LWK6tgp5zWT2xogISYXqhr31A9FCfOG6gV4uEnzew/U7GJiwGHeJpznCp9hRy6mZFw UlxluhzKsYxgUSto1RqIDFO6q7hSs8/CQRsG8J/4ss9sDrOKsnXFagW3UWp+T12LFY+3 BBwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794900360; x=1795505160; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MMBRZLq/TsBvn0Y94NXCqK1Bsnm45BwX3Eul3FpIPdg=; b=B5SyRL5H1m8cblpPunhB+dlV2upQ+SR18aG9gWxnhdoHi+xvp51ckrji1jCJeUPOmY Qp+g+fadsX8mneCelQEla5x903J9lYCaDjNjkMSk3d0dwfFTngU7A+jEfCjpEaBQ/lED bHojTLPt3mqmzZlbeWI5Cy0Vb/D0N29sqOqd06HxVwLdD6KRl8ffZAYgVyJaZ1oyHRv8 DfHQso2PW0rm1GMPNf9/Hhw257gWFHSoX+3mr0RNj9pPLBXjx6RLyCPjDy22+p2RmE7n Bt3KSZhQpK0OtQMShIczITmOpoAozk7FvXB7Tr/3yqQQJhfmskHsGq+piGHvd3F4UDsR DZGQ== X-Gm-Message-State: APuU4Z/Hb+cEgw8l+fz0HbFqLTg7ivr6ovOQ/0V9uqVc0WvM+/0hDEUe CyGNGAlBez3XbhiOf01w7YGZ6JsGUKdFdxOTaFLCqq3De1hOsf1dchrl X-Gm-Gg: AZFdTZefdnDTjhMQdUZcybKEJuRGNNbpCGUty0Lm5ZOPEC5kRGt0DE/4pOnXyY06IWU ymdc/OEgUn06CtecH16+wW+70sO9RA8BLEgI+du4buNNEIqvIb6VaDpQpadgFLl1kv2d0aX8/km t9v2bklSpajjhSZWZXgWPOqrKphOH+2ETIhgbn5Wj0/axUgE5nETxbIXqcjQ466amVPjLsrGXgb bVWg8NJ3D9xcWj36iUSiNkrw8kulHwBixajZOh7vHrLz+dtaPpvz+GqlhWgg1fDMsCD9wxrkgeC 6ybQjvD9zRlnq43wOZHbtGJ6OtdGT+SmVzxXEq8FLaSNeEtUs3PmhCTKY5+0Vp3uw3ajfzL49l0 IDF3V/+S+3FW3jEClgAxBpgkzMZjqg3bOz3+XCaf9q5XrWiRPQyHCr1qQPsyVyiwbdzw4uY8Goq hkbva8tsJxuNPoX2ZpAcWp8wPFdfFz5NUYB7Vopr3j07TeHaQH22Wc9gbIIiHMc7gh1D/Lpsq29 kyEiqcHEa7jLMqSVjNMJQy8Co+RxDH6o4JC6Repz41BmEF9hcDf1uwx5heuSWpOPW+umDTEvcui tkWjmPwJAyOuw4aXKgw9eCvJodTyrhcViqo/B0U= X-Received: by 2002:a17:90b:586c:b0:3b0:ab34:afc8 with SMTP id 98e67ed59e1d1-3b1b0b67f13mr11327892a91.20.1794900360498; Mon, 16 Nov 2026 23:26:00 -0800 (PST) Received: from smtpclient.apple ([185.135.79.161]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b3ac4ddecasm2691655a91.14.2026.11.16.23.25.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2026 23:25:59 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.700.51.1.1\)) Subject: Re: [PATCH v1] pg_stash_advice: Reject embedded NUL bytes in persistence files From: Chao Li In-Reply-To: Date: Tue, 17 Nov 2026 15:25:25 +0800 Cc: PostgreSQL Hackers , Robert Haas Content-Transfer-Encoding: quoted-printable Message-Id: <7010C1D7-7ADD-40F2-B00E-47074CA4F8CA@gmail.com> References: To: Haibo Yan X-Mailer: Apple Mail (2.3864.700.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Nov 17, 2026, at 10:35, Haibo Yan wrote: >=20 > Hi hackers, >=20 > The initial leads for this work came from several independent > LLM-assisted reviews of the plan advice code. The reviews identified > several candidate issues, which we then reproduced and checked > individually. Several issues were confirmed. >=20 > This is the first patch we are posting from that review. It addresses > one of the confirmed issues. The remaining fixes are independent and > will be submitted separately after their tests and reviews are > complete. >=20 > pg_stash_advice reads its persistence file into memory, but the loader > previously parsed the buffer as a NUL-terminated string. If the file > contained an embedded NUL byte, the loader silently treated it as the > end of the file and accepted only the preceding records. Hi Haibo, Thanks for the patch. I'm just curious why a file might contain an embedded NUL byte. Is there = a known scenario where pg_stash_advice.tsv could contain a NUL byte? If = that's because of file corruption, couldn't any byte appear in the = middle of the file? In that case, is checking only for NUL bytes good = enough? Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/