Validate xlog record header before enlarging the work area to store it.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sat, 30 Jun 2012 20:08:34 +0000 (23:08 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Sat, 30 Jun 2012 20:14:35 +0000 (23:14 +0300)
commit567787f216da750b3805aea6fd8aef19e8b882a1
tree7af380025b06f331c93d4761cc0ddb3d4c59bfd0
parent42e2ce6ae3e931953135a55b173a5ec4c54506c4
Validate xlog record header before enlarging the work area to store it.

If the record header is garbled, we're now quite likely to notice it before
we try to make a bogus memory allocation and run out of memory. That can
still happen, if the xlog record is split across pages (we cannot verify
the record header until reading the next page in that scenario), but this
reduces the chances. An out-of-memory is treated as a corrupt record
anyway, so this isn't a correctness issue, just a case of giving a better
error message.

Per Amit Kapila's suggestion.
src/backend/access/transam/xlog.c