Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 6A2D611948AC for ; Fri, 27 Apr 2012 05:14:19 -0300 (ADT) Received: from moutng.kundenserver.de ([212.227.126.186]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SNgJj-00034T-Ny for pgsql-jdbc@postgresql.org; Fri, 27 Apr 2012 08:14:18 +0000 Received: from tbz-emx-mobil.localnet ([85.183.3.43]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LoNd0-1RhSwV3mCA-00gVT6; Fri, 27 Apr 2012 10:14:02 +0200 From: "ml-tb" Reply-To: ml-tb@emagixx.de To: pgsql-jdbc@postgresql.org Subject: Re: Possible bug in ServerErrorMessage.java Date: Fri, 27 Apr 2012 10:13:57 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201204271013.57993.ml-tb@emagixx.de> X-Provags-ID: V02:K0:01aGRaBKax6rZKp5AKxJbLa/v0vG5KO4f2fErn4+oPI ePDiXId7bW+Lig4Z51+3kL53dgvGby0qzWDKSlB9KRoXToZj51 bveMrkBP9fB3+e/pasjmyq9JFR7hg7es9WG7Yp4OzEaQhNmC6r 0okX4DaClDcVUyfta7R52UFC3z6+qtHkGFmZLpRLHIQC6yjFue VRu9UJRozfq4A2O1TOB+HF+m01niijcI7A/h7dEZNKMQj8DuAt X6jHfIkPy8jrZFJ3eMl5A4t82XMzv4AHuxSd6G0nE+1ibcHD+r AE6sMQGediV40UmIh5FYE4uLspXbhkUx4XtwpdP+y6xfD4RRlL E6w3y0xyLAxeHAaZh/Brp56muZzypU+HfuOtf/bgz X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/94 X-Sequence-Number: 22894 Am Freitag, 27. April 2012 schrieb Maciek Sakrejda: > > From what I've seen the line 48 and the following are: > > > > while (l_chars[l_pos] != '\0' && l_pos < l_length) > > { > > > > l_pos++; > > > > } > > > > which IMO should be changed in: > > while (l_pos < l_length && l_chars[l_pos] != '\0') > > This seems to be the code in question, to decode the wire > ErrorResponse message: > > https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/Serv > erErrorMessage.java#L32 > > Although what you suggested would be more defensive coding, Sorry for correct you at this point: The suggested code ist not more defensive but the only correct way for a save (unsyncronised) array access. Bye Thomas