Additional fixes for possible overflows in length-related
calculations in 'spatial' implementations.
Checks added to the ::get_data_size() methods.
max_n_points decreased to occupy less 2G size. An
object of that size is practically inoperable anyway.
The bug was found by Alyssa Milburn.
If the number of points of a geometry feature read from
binary representation is greater than 0x10000000, then
the (uint32) (num_points * 16) will cut the higher byte,
which leads to various errors.
Fixed by additional check if (num_points > max_n_points).
The bug was found by Alyssa Milburn.
If the number of points of a geometry feature read from
binary representation is greater than 0x10000000, then
the (uint32) (num_points * 16) will cut the higher byte,
which leads to various errors.
Fixed by additional check if (num_points > max_n_points).
Problem:
lack of incoming geometry data validation may
lead to a server crash when ISCLOSED() function called.
Solution:
necessary incoming data check added.
mysql-test/r/gis.result:
Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
test result.
mysql-test/t/gis.test:
Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
test case.
sql/spatial.cc:
Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
check if a LINESTRING has at least one point as we
rely on that further.
per-file comments:
mysql-test/t/gis-precise.test
number-to-string conversion differs on Windows.
Have to tolerate this while GIS data is stored in doubles.
sql/spatial.cc
prev_x initialization added.
return GEOMETRYCOLLECTION EMPTY, not NULL for the query
per-file comments:
mysql-test/r/gis.result
fix for 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
test result updated.
sql/spatial.cc
fix for 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
return of the Geometry::envelope() changed for the empty geometry.
855485 ST_CROSSES returns different result than PostGIS for overlapping polygons
855487 ST_WITHIN returns wrong result for partially overlapping polygons
855492 ST_WITHIN returns TRUE on point on the edge of a polygon
855497 ST_ENVELOPE of GEOMETRYCOLLECTION EMPTY returns NULL and not GEOMETRYCOLLECTION EMPTY
855503 ST_EQUALS reports TRUE between a POLYGON and a MULTILINESTRING
855505 ST_TOUCHES reports TRUE for intersecting polygon and linestring
Changed the way weird functions like Crosses or Touches treated.
Added BORDER handling to the Gcalc_function.
per-file comments:
mysql-test/r/gis-precise.result
GIS bugs fixed.
test result updated.
mysql-test/t/gis-precise.test
GIS bugs fixed.
test cases added.
sql/gcalc_slicescan.h
GIS bugs fixed.
sql/gcalc_tools.cc
GIS bugs fixed.
sql/gcalc_tools.h
GIS bugs fixed.
sql/item_create.cc
GIS bugs fixed.
sql/item_geofunc.cc
GIS bugs fixed.
sql/item_geofunc.h
GIS bugs fixed.
sql/spatial.cc
GIS bugs fixed.
per-file comments:
mysql-test/r/gis.result
bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs fixed.
test result updated.
mysql-test/t/gis.test
bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs fixed.
test case added.
sql/item_geofunc.cc
bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs fixed.
geom_length() call fixed.
sql/spatial.cc
bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs fixed.
Geometry_collection::geom_length implemented.
sql/spatial.h
bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs fixed.
Geometry_collection::geom_length declaration added.
855253 Compiler error: gcalc_slicescan.cc:2036: error: suggest parentheses around comparison in operand of .|. in maria-5.3-gis
850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
per-file comments:
mysql-test/r/gis.result
test result updated.
mysql-test/t/gis.test
test case added for 850775.
sql/gcalc_slicescan.cc
compiler error fixed.
sql/spatial.cc
ST_AREA implementation for GEOMETRY_COLLECTION, POINT and LINESTRING.
sql/spatial.h
area() declarations added.
849789 Second assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis
849791 Fourth assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sincos
849789 Second assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis
848901 Assertion `fabs(cur_isc->x-m_cur_intersection->x) + fabs(cur_isc->y-m_cur_intersection->y) < 0.000000000001' failed in Gcalc_scan_iterator::intersection_scan() in maria-5.3-gis
per-file comments:
mysql-test/r/gis-precise.result
test result updated.
mysql-test/r/gis.result
test result updated.
sql/gcalc_slicescan.cc
bugfixes.
sql/gcalc_slicescan.h
bugfixes.
sql/gcalc_tools.cc
bugfixes.
sql/gcalc_tools.h
bugfixes.
sql/item_geofunc.cc
bugfixes.
sql/spatial.cc
bugfixes.
We didn't implement an empty geometry. And returning NULL instead of it is not
quite correct. So here is the implementation of the empty value as GEOMETRYCOLLECTION().
per-file comments:
mysql-test/r/gis-precise.result
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
test result updated.
mysql-test/r/gis.result
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
test result updated.
mysql-test/t/gis-precise.test
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
test case added.
mysql-test/t/gis.test
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
test case added.
sql/field.cc
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
store GEOMETRYCOLLECTION() properly.
sql/gcalc_tools.cc
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
create the GEOMETRYCOLLECTION() for the empty result.
sql/gstream.h
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
next_symbol() added.
sql/spatial.cc
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
code modified to handle 0 geometries in the GEOMETRYCOLLECTION properly.
If the result contains a polygon with a hole, consequitive shapes weren't calculated
properly, as the hole appeared as shape in the result, but actually it's a single shape
with the surrounding polygon. It's more natural to use the size of the result as
a border instead of the number of resulting shapes.
per-file comments:
mysql-test/r/gis-precise.result
fix for bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
test result updated.
mysql-test/t/gis-precise.test
fix for bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
test case added.
sql/spatial.cc
fix for bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
check the data lenght instead of number of shapes.
sql/spatial.h
fix for bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
check the data lenght instead of number of shapes.
Check for number of line strings in the incoming polygon data (wkb) and
for number of points in the incoming linestring wkb.
mysql-test/r/gis.result:
Fix for bug #51875: crash when loading data into geometry function polyfromwkb
- test result.
mysql-test/t/gis.test:
Fix for bug #51875: crash when loading data into geometry function polyfromwkb
- test case.
sql/spatial.cc:
Fix for bug #51875: crash when loading data into geometry function polyfromwkb
- creating a polygon from wkb check for number of line strings,
- creating a linestring from wkb check for number of line points.
Fix warnings flagged by the new warning option -Wunused-but-set-variable
that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The
option causes a warning whenever a local variable is assigned to but is
later unused. It also warns about meaningless pointer dereferences.
client/mysql.cc:
Meaningless pointer dereferences.
client/mysql_upgrade.c:
Check whether reading from the file succeeded.
extra/comp_err.c:
Unused.
extra/yassl/src/yassl_imp.cpp:
Skip instead of reading data that is discarded.
include/my_pthread.h:
Variable is only used in debug builds.
include/mysys_err.h:
Add new error messages.
mysys/errors.c:
Add new error message for permission related functions.
mysys/mf_iocache.c:
Variable is only checked under THREAD.
mysys/my_copy.c:
Raise a error if chmod or chown fails.
mysys/my_redel.c:
Raise a error if chmod or chown fails.
regex/engine.c:
Use a equivalent variable for the assert.
server-tools/instance-manager/instance_options.cc:
Unused.
sql/field.cc:
Unused.
sql/item.cc:
Unused.
sql/log.cc:
Do not ignore the return value of freopen: only set buffer if
reopening succeeds.
Adjust doxygen comment to the right function.
Pass message lenght to log function.
sql/mysqld.cc:
Do not ignore the return value of freopen: only set buffer if
reopening succeeds.
sql/partition_info.cc:
Unused.
sql/slave.cc:
No need to set pointer to the address of '\0'.
sql/spatial.cc:
Unused. Left for historical purposes.
sql/sql_acl.cc:
Unused.
sql/sql_base.cc:
Pointers are always set to the same variables.
sql/sql_parse.cc:
End statement if reading fails.
Store the buffer after it has actually been updated.
sql/sql_repl.cc:
No need to set pointer to the address of '\0'.
sql/sql_show.cc:
Put variable under the same ifdef block.
sql/udf_example.c:
Set null pointer flag appropriately.
storage/csv/ha_tina.cc:
Meaningless dereferences.
storage/example/ha_example.cc:
Return the error since it's available.
storage/myisam/mi_locking.c:
Remove unused and dead code.
strict aliasing violations.
Another rather noisy violation of strict aliasing rules
is the spatial code which makes use of stack-based memory
(of type Geometry_buffer) to provide placement for Geometry
objects. Although a placement new is allowed to dynamically
change the type of a object, the object returned by the
new placement was being ignored and the original stack-based
object was being casted to the new type, thus violating strict
aliasing rules.
The solution is to reorganize the code so that the object
returned by the new placement is used instead of casting the
original object. Also, to ensure that the stack-based object
is properly aligned with respect to the objects it provides
placement for, a set of compiler-dependent macros and types
are introduced so that the alignment of objects can be inquired
and specified.
include/Makefile.am:
Add new header.
include/my_compiler.h:
Add new header.
include/my_global.h:
Remove now-unnecessary macros.
sql/spatial.cc:
Make object creation functions return the object whose type
was dynamically changed by the new placement.
Move static method from the header in order to avoid having
to access a forward declaration.
sql/spatial.h:
Object creation callbacks now take a array of chars as the
storage area.
Move create_by_typeid to a source file as to not access the
forward declaration of Geometry_buffer.
Ensure that Geometry_buffer is properly aligned.
sql/sql_show.cc:
Use newly added aligned storage helper.
Add -Wall to gcc/g++
Fix most warnings reported in dbg and opt mode.
cmd-line-utils/libedit/filecomplete.c:
Remove unused auto variables.
configure.cmake:
Add -Wall to gcc.
extra/comp_err.c:
Cast to correct type.
extra/perror.c:
Fix segfault (but warnings about deprecated features remain)
extra/yassl/taocrypt/include/runtime.hpp:
Comparing two literals was reported as undefined behaviour.
include/my_global.h:
Add a template for aligning character buffers.
mysys/lf_alloc-pin.c:
Initialize pointer.
sql/mysqld.cc:
Use UNINIT_VAR rather than LINT_INIT.
sql/partition_info.cc:
Use UNINIT_VAR rather than LINT_INIT.
sql/rpl_handler.cc:
Use char[] rather than unsigned long[] array for placement buffer.
sql/spatial.cc:
Use char[] rather than unsigned void*[] array for placement buffer.
sql/spatial.h:
Use char[] rather than unsigned void*[] array for placement buffer.
sql/sql_partition.cc:
Initialize auto variable.
sql/sql_table.cc:
Initialize auto variables.
Add parens around assignment within if()
sql/sys_vars.cc:
Use UNINIT_VAR.
storage/innobase/os/os0file.c:
Init first slot in auto variable.
storage/myisam/mi_create.c:
Use UNINIT_VAR rather than LINT_INIT.
storage/myisam/mi_open.c:
Remove (wrong) casting.
storage/myisam/mi_page.c:
Remove (wrong) casting.
storage/myisam/mi_search.c:
Cast to uchar* rather than char*.
strings/ctype-ucs2.c:
Use UNINIT_VAR rather than LINT_INIT.
Add (uchar*) casting.
This patch:
- Moves all definitions from the mysql_priv.h file into
header files for the component where the variable is
defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
Multi_polygon::centroid() has an error in the implementation
per-file messages:
sql/spatial.cc
Bug#38959 archive_gis fails due to rounding difference
multi_polygon::centroid() implementation fixed