pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Shigeru Hanada <shigeru.hanada@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: control character check in JSON type seems broken
Date: Mon, 04 Jun 2012 20:48:09 -0400
Message-ID: <21413.1338857289@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEZqfEdbRO8MhH83Fma9uSQhCfWmHpgcbm9Lwucq2HSwCHhbdQ@mail.gmail.com>
References: <CAEZqfEdbRO8MhH83Fma9uSQhCfWmHpgcbm9Lwucq2HSwCHhbdQ@mail.gmail.com>

Shigeru Hanada <shigeru.hanada@gmail.com> writes:
> json_lex_string() misjudges that the token "キー" contains naked
> (not-escaped) control character, because its first byte is 0xe3 and it's
> -29 for signed char interpreting, and it's less than 32.  We need to
> cast to unsigned char (or use unsigned variable) here.

Yeah, that's wrong.

> In addition, error message above seems corrupted in my environment.
> Here we check not-escaped control character, so printing it with %c
> formatting might break log files.  How about using decimal or hex dump
> in such cases?

And so is that.  IMO the error reporting in this module could stand to
be reviewed altogether for compliance with our message guidelines.
(For starters, why is it using errdetail_internal?)  I refrained from
editorializing on-the-fly, but I'm not too pleased with what I saw.

Patch applied, thanks!

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <21413.1338857289@sss.pgh.pa.us>
Permalink:  ../21413.1338857289@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21413.1338857289@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, shigeru.hanada@gmail.com
  Subject: Re: control character check in JSON type seems broken
  In-Reply-To: <21413.1338857289@sss.pgh.pa.us>
  References: <CAEZqfEdbRO8MhH83Fma9uSQhCfWmHpgcbm9Lwucq2HSwCHhbdQ@mail.gmail.com> <21413.1338857289@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox