1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#20752: BENCHMARK with many iterations returns too quickly

In BENCHMARK(count, expr), count could overflow/wrap-around.
Patch changes to a sufficiently large data-type. Adds a warning
for negative count values.


mysql-test/r/func_str.result:
  show that a negative 'count' for BENCHMARK(count, expr)
  throws a warning and returns NULL.
mysql-test/t/func_str.test:
  show that a negative 'count' for BENCHMARK(count, expr)
  throws a warning and returns NULL.
sql/item_func.cc:
  use ulonglong rather than ulong in BENCHMARK(count, expr)
  throw warning on negative 'count'; return SQL-NULL.
This commit is contained in:
unknown
2008-02-24 01:31:54 +01:00
parent 72f1b329e1
commit 7b8717ace8
3 changed files with 26 additions and 4 deletions

View File

@ -1431,6 +1431,11 @@ benchmark(100, NULL)
select benchmark(NULL, 1+1);
benchmark(NULL, 1+1)
NULL
select benchmark(-1, 1);
benchmark(-1, 1)
NULL
Warnings:
Error 1411 Incorrect count value: '-1' for function benchmark
set @password="password";
set @my_data="clear text to encode";
select md5(encode(@my_data, "password"));