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.94.2) (envelope-from ) id 1uFlUa-008KtD-6J for pgsql-committers@arkaria.postgresql.org; Fri, 16 May 2025 03:12:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uFlTZ-00Halz-RV for pgsql-committers@arkaria.postgresql.org; Fri, 16 May 2025 03:11:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uFlTZ-00Halr-Kd for pgsql-committers@lists.postgresql.org; Fri, 16 May 2025 03:11:09 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uFlTT-0020yp-22 for pgsql-committers@lists.postgresql.org; Fri, 16 May 2025 03:11:08 +0000 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-74237a74f15so2316015b3a.0 for ; Thu, 15 May 2025 20:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1747365063; x=1747969863; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=hJ5HRkVjPA7vM23AZ9RqBcl4/G3R1qGs2f/JLAJ8nJQ=; b=I0UkUUxfmcyisIbP330IpShpjhSAYr0lg8E6g1ieZsrxIuc9qriIlh25NWihsr6/L2 v16SASMj4L3e0lkfva8CVILY72Vc7rBi4gi+TfRIAP2dAkTCjqKh7SvdM4AQwR8qxChg cCggCzF+RQwuFt8uS+GG2dKGmx7iuw62+o92U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747365063; x=1747969863; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hJ5HRkVjPA7vM23AZ9RqBcl4/G3R1qGs2f/JLAJ8nJQ=; b=bZvtzt8n1JLG634sX1ZBc4NkoRqbx1n+jItsWKtN4o5eF6VXqudkydGz86JlNGE6al fCPRMKTfVPJmQ+i8M9+L/Ry+Y3dFryF5g7gj60bzrtIrUq5g92yawNZMvjAATSUQ+OM9 p8g/AslEZJ3yQ2IToCQ2CN7Op0N2/4YdOONwYn2Of3YLAnAJc2MF6XZiDBe6W/b7l67i Xr84ZUWAOBOijwWvpK7mMX/VghGVKE4OZu6mhWg4272e1kBL5BdNVsgkvSUEz8bJXbTF Fg4lCbSI0gRFVrHrsRII4kYqYL6Gz2s7E3GGXbRHKHcUuesMOM8Be9ipLx/gP4DwaqQX 6W0A== X-Gm-Message-State: AOJu0YxIMXDDXFwjYL06jATNDmgxaqw5VkbY7Hrs3pOsRzOT+Diin8Jh RiV+zE+bmKsd8MOXP662VuDwqGiXALxu6PEXNJ1/8BfNN5B/bm4YsVE9LzHv2tja7w== X-Gm-Gg: ASbGncuyOaDRpafV0fI5rd0Lc62HCY9zFqRbtxr8g4ccNXaNjGa4U6qHUHN/BG9Kutf wVi4KH/AmKfUxqEayCFvPAESRATqAY3yeLskqZus8AUM996HQla/zEKKGIyEllNBtDzgm6yMYb/ Zg2fM/xQwySowVkESpUlurvngGryUioQkJVuOuc3zXSFFz+GL9zRz5/HSi2Oo4oDVmPSBZDw9WI 5BKLYU1ErBiqpLC8WDgCRGzC/c/rB9tk9CpIDLKed/JOkN8lsvN/V24zD9Uxs/wzxUhjQZigPnl v4ue3mDO8ojBqYliXVqzCHxzU6n1XS9xgWT2aVwxAZFnVrWO X-Google-Smtp-Source: AGHT+IGpzF+0QcdxbfndeomIW1WkW3BRUDXPzqgc3gC43coqC2r7XTpQH4izo3kb8//bkB8R6t/SLw== X-Received: by 2002:a05:6a20:3d83:b0:20d:d31c:cd28 with SMTP id adf61e73a8af0-21621876c6cmr2751421637.7.1747365063294; Thu, 15 May 2025 20:11:03 -0700 (PDT) Received: from google.com ([2601:647:5600:80d0::31cd]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-742a9709293sm542913b3a.37.2025.05.15.20.11.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 May 2025 20:11:02 -0700 (PDT) Date: Thu, 15 May 2025 20:11:00 -0700 From: Noah Misch To: sean Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: With GB18030, prevent SIGSEGV from reading past end of allocatio Message-ID: <20250516031100.8c.nmisch@google.com> References: <3674cec2.7edf.196cdf19dbf.Coremail.zoulx1982@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3674cec2.7edf.196cdf19dbf.Coremail.zoulx1982@163.com> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, May 14, 2025 at 04:38:06PM +0800, sean wrote: > I read the patch you commit to pgsql, and i found there also some other routine which > will still call pg_encoding_mblen to get char length. > I have no idea why these routine don't have to replaced by call pg_encoding_mblen_or_incomplete? See the pg_encoding_mblen() header comment for the rules on when calling it is okay. For example, it's okay for NUL-terminated input. > And how can i do to reproduce this crash? The patch-added test cases provide some indication on how to reproduce the crash.