• Tom Lane's avatar
    Avoid somewhat-theoretical overflow risks in RecordIsValid(). · 10685ec0
    Tom Lane authored
    This improves on commit 51fed14d by
    eliminating the assumption that we can form <some pointer value> +
    <some offset> without overflow.  The entire point of those tests is that
    we don't trust the offset value, so coding them in a way that could wrap
    around if the buffer happens to be near the top of memory doesn't seem
    sound.  Instead, track the remaining space as a size_t variable and
    compare offsets against that.
    
    Also, improve comment about why we need the extra early check on
    xl_tot_len.
    10685ec0
xlog.c 317 KB