Content-Length: 249090 | pFad | http://github.com/postgres/postgres/commit/eb851c998d2a37a6512a26dba11a303babe6316a

B2 Fix psql crash while parsing SQL file whose encoding is different from · postgres/postgres@eb851c9 · GitHub
Skip to content

Commit eb851c9

Browse files
committed
Fix psql crash while parsing SQL file whose encoding is different from
client encoding and the client encoding is not *safe* one. Such an example is, file encoding is UTF-8 and client encoding SJIS. Patch contributed by Jiang Guiqing.
1 parent 9009ec0 commit eb851c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bin/psql/psqlscan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1656,7 +1656,7 @@ prepare_buffer(const char *txt, int len, char **txtcopy)
16561656
/* first byte should always be okay... */
16571657
newtxt[i] = txt[i];
16581658
i++;
1659-
while (--thislen > 0)
1659+
while (--thislen > 0 && i < len)
16601660
newtxt[i++] = (char) 0xFF;
16611661
}
16621662
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgres/postgres/commit/eb851c998d2a37a6512a26dba11a303babe6316a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy