Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-09-29 Thread Richard Yen
> On Sep 29, 2021, at 9:01 AM, Christoph Berg wrote: > > Re: Richard Yen >> Ah, thanks for the tip. That's right -- I can't assume the user's input is >> a valid file. Updated patch here. > > Hi Richard, > > sorry for the very late response here. > > Thanks for the patch which I just merg

Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-09-29 Thread Christoph Berg
Re: Richard Yen > Ah, thanks for the tip. That's right -- I can't assume the user's input is > a valid file. Updated patch here. Hi Richard, sorry for the very late response here. Thanks for the patch which I just merged, and thanks Justin for the reviews! Christoph

Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-04-29 Thread Richard Yen
On Thu, Apr 29, 2021 at 12:05 PM Justin Pryzby wrote: > I think you should be able to avoid crashing if passed a non-relmapper > file. > Make sure not to loop over more mappings than exist in the relmapper file > of > the given size. > > I guess you should warn if the number of mappings is too la

Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-04-29 Thread Justin Pryzby
I think you should be able to avoid crashing if passed a non-relmapper file. Make sure not to loop over more mappings than exist in the relmapper file of the given size. I guess you should warn if the number of mappings is too large for the file's size. And then "cap" the number of mappings to th

Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-04-29 Thread Richard Yen
Thanks for the feedback, Justin. I've gone ahead and switched to use memcmp. I also refactored it to: 1. Don't assume that any file with first 4 bytes matching the relmapper magic number is a pg_relnode.map file 2. Don't assume the pg_relnode.map file is uncorrupted and intact; perform a check o

Re: Patch to allow pg_filedump to support reading of pg_filenode.map

2021-04-28 Thread Justin Pryzby
This is separate from the postgresql server repo. https://git.postgresql.org/gitweb/?p=pg_filedump.git +#define RELMAPPER_FILEMAGIC 0x592717 +char magic_buffer[8]; ... + if ( (int) magic_buffer & RELMAPPER_FILEMAGIC ) { This is doing bitwise arithmetic on a pointer, which seems badly wrong.