Commit graph

103 commits

Author SHA1 Message Date
Sergei Golubchik
6599fd3e9c 5.3 merge 2013-03-27 10:03:28 +01:00
Sergei Golubchik
e308d7417b 5.2 merge 2013-03-26 19:09:47 +01:00
Alexey Botchkov
045c498691 GEOMETRYCOLLECTION EMPTY handling fixed.
The get_mbr() method shouldn't return the error, rather an invalid MBR
          in this case.
2013-03-26 21:47:06 +04:00
Alexey Botchkov
ef737284b4 MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint.
Need to check if the number of points is 0 for the polygon.
2013-03-19 17:25:58 +04:00
Alexey Botchkov
15a7335d77 MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy.
Forgotten DBUG_ASSERT should be replaced with the 'return error'.
2013-03-19 17:16:10 +04:00
Alexey Botchkov
589247ae86 MDEV-4252 geometry query crashes server.
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.
2013-03-18 17:58:00 +04:00
Alexey Botchkov
511b943263 MDEV-4252 geometry query crashes server.
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).
2013-03-10 23:08:05 +04:00
Alexey Botchkov
7fb55ee807 TODO-424 geometry query crashes server.
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).
2013-03-06 01:45:25 +04:00
unknown
3f59033536 Merge MariaDB 5.1.66 -> 5.2 -> 5.3 2012-11-09 10:11:20 +02:00
unknown
7c23d6d0c6 Merge MySQL 5.1.66 -> MariaDB 5.1.65 2012-11-06 11:52:55 +02:00
Sergei Golubchik
ee9afef271 mysql-5.5.28 2012-10-16 13:04:42 +02:00
Alexander Barkov
444a081c83 Merging from 5.5 2012-08-17 13:18:56 +04:00
Alexander Barkov
5aec4e2b3b Backporting Bug 14100466 from 5.6. 2012-08-17 13:14:04 +04:00
Sergei Golubchik
0522307ed1 mysql-5.5 merge 2012-06-14 20:05:31 +02:00
Sergei Golubchik
7f6f53a8df 5.2 merge 2012-05-20 14:57:29 +02:00
Sergei Golubchik
0a8c9b98f6 merge with mysql-5.1.63 2012-05-17 12:12:33 +02:00
Sergei Golubchik
431e042b5d c 2012-05-21 15:30:25 +02:00
Joerg Bruehe
5be07ceadd Merge 5.5.24 back into main 5.5.
This is a weave merge, but without any conflicts.
In 14 source files, the copyright year needed to be updated to 2012.
2012-05-07 22:20:42 +02:00
Ramil Kalimullin
d371d53945 Auto-merge from mysql-5.1-security. 2012-03-05 22:36:56 +04:00
Ramil Kalimullin
8aea62fa8a Fix for BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
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.
2012-03-05 21:58:07 +04:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Sergei Golubchik
effed09bd7 5.3->5.5 merge 2011-11-27 17:46:20 +01:00
Alexey Botchkov
7b08d99627 fixes to make compilers happy.
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.
2011-11-24 16:26:13 +04:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Alexey Botchkov
53ad390ff0 fix for 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
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.
2011-09-23 15:05:36 +05:00
Alexey Botchkov
5123f59ed2 fixed bugs
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.
2011-09-22 18:53:36 +05:00
Alexey Botchkov
d0f2e1e551 bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs 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.
2011-09-21 13:26:21 +05:00
Alexey Botchkov
6b64baf3b9 fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
per-file comments:
  mysql-test/r/gis.result
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        test result updated.
  mysql-test/t/gis.test
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        test case added.
  sql/gstream.cc
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        lookup_next_word() implemented.
  sql/gstream.h
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        lookup_next_word() added.
  sql/spatial.cc
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        name changed for the empty geometry.
  sql/spatial.h
fix for bug 848926 GIS functions return "GEOMETRYCOLLECTION()" instead of "GEOMETRYCOLLECTION EMPTY"
        declarations modified.
2011-09-21 12:50:03 +05:00
Alexey Botchkov
25b5019c34 bugs fixed
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.
2011-09-21 09:29:37 +05:00
Alexey Botchkov
0249413a6a several bugs fixed here.
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.
2011-09-21 00:04:41 +05:00
Alexey Botchkov
eefff87652 bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
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.
2011-09-04 19:11:04 +05:00
Alexey Botchkov
152f3c5e28 PostGIS-style 'same point' handling. 2011-09-01 11:44:56 +05:00
Kent Boortz
e7c781e58b Updated/added copyright headers 2011-07-03 20:08:47 +02:00
Kent Boortz
bb3723835e Updated/added copyright headers 2011-06-30 21:27:04 +02:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Alexey Botchkov
4f49cdf8d3 fix for bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
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.
2011-06-30 18:18:27 +05:00
Kent Boortz
789aa8c485 Updated/added copyright headers 2011-07-04 01:25:49 +02:00
Kent Boortz
02e07e3b51 Updated/added copyright headers 2011-06-30 17:46:53 +02:00
Alexey Botchkov
788043cd0b Precise GIS functions added. 2011-05-04 23:20:17 +05:00
Ramil Kalimullin
1077c85fe3 Fix for bug#51875/#11759554 backported from mysql-5.1. 2011-03-21 09:21:14 +03:00
Ramil Kalimullin
385a473803 Automerge. 2010-09-06 13:54:44 +04:00
Ramil Kalimullin
6a113b215a Fix for bug #51875: crash when loading data into geometry function polyfromwkb
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.
2010-08-30 11:51:46 +04:00
Davi Arnaut
182599dd13 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-20 16:30:10 -03:00
Davi Arnaut
9a5fa17fd3 Bug#45288: pb2 returns a lot of compilation warnings on linux
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.
2010-07-20 15:07:36 -03:00
Davi Arnaut
7f1eedec2d Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-14 11:12:26 -03:00
Davi Arnaut
f317d3a6fb Bug#42733: Type-punning warnings when compiling MySQL --
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.
2010-07-14 09:27:13 -03:00
Tor Didriksen
85da8956e6 Bug #53445 Build with -Wall and fix warnings that it generates
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.
2010-05-26 16:12:23 +02:00
Mats Kindahl
23d8586dbf WL#5030: Split and remove mysql_priv.h
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
2010-03-31 16:05:33 +02:00
Alexey Botchkov
df460f4e43 Bug#38959 archive_gis fails due to rounding difference
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
2010-02-17 14:19:17 +04:00