• Tom Lane's avatar
    Avoid calling memcpy() with a NULL source pointer and count == 0. · 13bba022
    Tom Lane authored
    As in commit 0a52d378, avoid doing something that has undefined
    results according to the C standard, even though in practice there does
    not seem to be any problem with it.
    
    This fixes two places in numeric.c that demonstrably could call memcpy()
    with such arguments.  I looked through that file and didn't see any other
    places with similar hazards; this is not to claim that there are not such
    places in other files.
    
    Per report from Piotr Stefaniak.  Back-patch to 9.5 which is where the
    previous commit was added.  We're more or less setting a precedent that
    we will not worry about this type of issue in pre-9.5 branches unless
    someone demonstrates a problem in the field.
    13bba022
numeric.c 178 KB