Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGLQM-0000SV-GS for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2014 04:39:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WGLQL-0002d4-TA for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Feb 2014 04:39:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGLQK-0002co-A4 for pgsql-hackers@postgresql.org; Thu, 20 Feb 2014 04:39:48 +0000 Received: from mail-qa0-f43.google.com ([209.85.216.43]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WGLQH-0001xn-5E for pgsql-hackers@postgresql.org; Thu, 20 Feb 2014 04:39:47 +0000 Received: by mail-qa0-f43.google.com with SMTP id o15so2278312qap.2 for ; Wed, 19 Feb 2014 20:39:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=ybAnQsmcogbA/y87mEB6WoZS+2T0e7ZwXB8tmvEEqFk=; b=WU6bqS6OZ1LfHtsptiqECYE4wwOTcu9xYgoKVvOe7RhYWX7s8ZfEhDSU7TKKLlUREG 1teg0HOshnvnMuyhOupUJGWSKWrJ1efatp6GfMKgW/9rsg9SSmPWhn+Vr7yp1iiY3+0u VnLK2vdyhaOVuR59N901EU3bDqIxhYcJthcl3MwsrouONZ9qK8gnjVa+Yo1MUogBfhw6 xnh5anLsre7WO4wVi7VTQ32DoaOci6IOfbcXMol55EbBp7KbhGayJyR2koBn7aZyXB/V 963xisGz7EfdfQ4M7doggR8Pb9cN7QfK4ZhtrMD8758l/ugjLeNBsy/O+4iSCy4iyT0s /UfA== X-Gm-Message-State: ALoCoQnVvZpp6MBQa5T8CnbfaRozcu6FKDTnGtwOgFXZlnnasQZ+ti3fMo3mo0xA47RwpdPzTlRv X-Received: by 10.224.16.72 with SMTP id n8mr7073338qaa.76.1392871183440; Wed, 19 Feb 2014 20:39:43 -0800 (PST) Received: from tornado.leadboat.com (c-107-4-219-91.hsd1.va.comcast.net. [107.4.219.91]) by mx.google.com with ESMTPSA id d7sm8368666qad.10.2014.02.19.20.39.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Feb 2014 20:39:42 -0800 (PST) Date: Wed, 19 Feb 2014 23:39:40 -0500 From: Noah Misch To: Tom Lane Cc: pgsql-bugs@postgresql.org, pgsql-hackers@postgresql.org, digoal@126.com Subject: Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding Message-ID: <20140220043940.GA3064539@tornado.leadboat.com> References: <20140213140759.2710.49877@wrigleys.postgresql.org> <20127.1392324548@sss.pgh.pa.us> <12131.1392760137@sss.pgh.pa.us> <4385.1392859333@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4385.1392859333@sss.pgh.pa.us> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Wed, Feb 19, 2014 at 08:22:13PM -0500, Tom Lane wrote: > The more I looked into mbutils.c, the less happy I got. The attached > proposed patch takes care of the missing-verification hole in > pg_do_encoding_conversion() and pg_server_to_any(), and also gets rid > of what I believe to be obsolete provisions in pg_do_encoding_conversion > to "work" if called outside a transaction --- if you consider it working > to completely fail to honor its API contract. That should no longer be > necessary now that we perform client<->server encoding conversions via > perform_default_encoding_conversion rather than here. I like these changes. In particular, coping with the absence of a conversion function by calling ereport(LOG) and returning the source string was wrong for nearly every caller, but you'd need to try an encoding like MULE_INTERNAL to notice the problem. Good riddance. > How much of this is back-patch material, do you think? None of it. While many of the failures to validate against a character encoding are clear bugs, applications hum along in spite of such bugs and break when we tighten the checks. I don't see a concern to override that here. Folks who want the tighter checking have some workarounds available. Thanks, nm -- Noah Misch EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers