• Georgi Kodinov's avatar
    Bug #16451878: GEOMETRY QUERY CRASHES SERVER · e7c48834
    Georgi Kodinov authored
    The GIS WKB reader was checking for the presence of
    enough data by first multiplying the number read (where
    it could overflow) and only then comparing it to the
    number of bytes available.
    This can overflow and effectively turn off the check.
    Fixed by:
    1. Introducing a new function that does division only so
    no overflow is possible.
    2. Using the proper macros and parenthesizing them.
    3. Doing an in-line division check in the only place where
    the boundary check is done over a data structure other
    than a dense points array.
    e7c48834
spatial.cc 42.8 KB