Commit 51fed14
committed
Don't get confused if a WAL partial record header has xl_tot_len == 0.
If a WAL record header was split across pages, but xl_tot_len was 0, we
would get confused and conclude that we had already read the whole record,
and proceed to CRC check it. That can lead to a crash in RecordIsValid(),
which isn't careful to not read beyond end-of-record, as defined by
xl_tot_len.
Add an explicit sanity check for xl_tot_len <= SizeOfXlogRecord. Also,
make RecordIsValid() more robust by checking in each step that it doesn't
try to access memory beyond end of record, even if a length field in the
record's or a backup block's header is bogus.
Per report and analysis by Tom Lane.1 parent 9b2a237 commit 51fed14
1 file changed
+36
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3707 | 3707 | | |
3708 | 3708 | | |
3709 | 3709 | | |
| 3710 | + | |
3710 | 3711 | | |
3711 | 3712 | | |
| 3713 | + | |
| 3714 | + | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
3712 | 3721 | | |
3713 | 3722 | | |
3714 | 3723 | | |
| |||
3721 | 3730 | | |
3722 | 3731 | | |
3723 | 3732 | | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
3724 | 3740 | | |
| 3741 | + | |
3725 | 3742 | | |
3726 | 3743 | | |
3727 | 3744 | | |
| |||
3730 | 3747 | | |
3731 | 3748 | | |
3732 | 3749 | | |
| 3750 | + | |
| 3751 | + | |
| 3752 | + | |
| 3753 | + | |
| 3754 | + | |
| 3755 | + | |
| 3756 | + | |
| 3757 | + | |
3733 | 3758 | | |
3734 | 3759 | | |
3735 | 3760 | | |
| |||
3879 | 3904 | | |
3880 | 3905 | | |
3881 | 3906 | | |
3882 | | - | |
3883 | | - | |
| 3907 | + | |
| 3908 | + | |
3884 | 3909 | | |
3885 | 3910 | | |
3886 | 3911 | | |
| |||
3889 | 3914 | | |
3890 | 3915 | | |
3891 | 3916 | | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
3892 | 3925 | | |
| 3926 | + | |
3893 | 3927 | | |
3894 | 3928 | | |
3895 | 3929 | | |
| |||
0 commit comments