• Heikki Linnakangas's avatar
    Avoid integer overflow in hstore_to_json(). · 0c5783ff
    Heikki Linnakangas authored
    The length of the output buffer was calculated based on the size of the
    argument hstore. On a sizeof(int) == 4 platform and a huge argument, it
    could overflow, causing a too small buffer to be allocated.
    
    Refactor the function to use a StringInfo instead of pre-allocating the
    buffer. Makes it shorter and more readable, too.
    0c5783ff
hstore_io.c 30.1 KB