Re: [HACKERS] fatal copy in/out error (6.5.3) - Mailing list pgsql-hackers

From Michael Robinson
Subject Re: [HACKERS] fatal copy in/out error (6.5.3)
Date
Msg-id 200001250605.OAA39630@netrinsics.com
Whole thread Raw
In response to Re: [HACKERS] fatal copy in/out error (6.5.3)  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: [HACKERS] fatal copy in/out error (6.5.3)
List pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
>Yes, it's not a PostgreSQL's business but is a really big problem in
>the real world. Maybe some HTML gurus might have good suggestions on
>these issues (something like using a language tag?)

The only solution is defensive programming.  Even if there were a standard
that everyone followed, if malicious people could break things by not
following the standard, then you can be certain that somebody would do so.

>Here it is. With this patch, copy out should be happy even with the
>wrong data. I'm not sure if it could be displayed correctly, though.

Thank you very much.  However, I think even this is too optimistic:

>!     if (*s & 0x80)

Shouldn't it be something like:
   if ((*s & 0x80) && (*(s+1) & 0x80))

Even though "\242\242\242\0" is an invalid EUC sequence, it still shouldn't be
allowed to break the software.
-Michael Robinson



pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace