pg_read_file_20100104.patch

application/octet-stream

Filename: pg_read_file_20100104.patch
Type: application/octet-stream
Part: 0
Message: Re: pg_read_file() and non-ascii input file

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
src/backend/utils/adt/genfile.c 4 0
diff -cprN head/src/backend/utils/adt/genfile.c work/src/backend/utils/adt/genfile.c
*** head/src/backend/utils/adt/genfile.c	2010-01-04 09:10:26.638773000 +0900
--- work/src/backend/utils/adt/genfile.c	2010-01-04 10:47:07.492409763 +0900
***************
*** 22,27 ****
--- 22,28 ----
  
  #include "catalog/pg_type.h"
  #include "funcapi.h"
+ #include "mb/pg_wchar.h"
  #include "miscadmin.h"
  #include "postmaster/syslogger.h"
  #include "storage/fd.h"
*************** pg_read_file(PG_FUNCTION_ARGS)
*** 131,136 ****
--- 132,140 ----
  				(errcode_for_file_access(),
  				 errmsg("could not read file \"%s\": %m", filename)));
  
+ 	/* Make sure the input is valid */
+ 	pg_verifymbstr(VARDATA(buf), nbytes, false);
+ 
  	SET_VARSIZE(buf, nbytes + VARHDRSZ);
  
  	FreeFile(file);