-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: properly check result of decimal parsing
This patch fixes a crash that can occur when SQL parses a decimal literal that represents a number greater than or equal to 10^38. Closes #9469 NO_DOC=bugfix (cherry picked from commit 05551a5)
- Loading branch information
1 parent
f0f252f
commit f54f59b
Showing
5 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## bugfix/sql | ||
|
||
* Fixed a crash when a decimal literal representing a decimal number greater | ||
than or equal to 10^38 was parsed in SQL (gh-9469). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local server = require('luatest.server') | ||
local t = require('luatest') | ||
|
||
local g = t.group() | ||
|
||
g.before_all(function() | ||
g.server = server:new({alias = 'master'}) | ||
g.server:start() | ||
end) | ||
|
||
g.after_all(function() | ||
g.server:stop() | ||
end) | ||
|
||
g.test_too_big_decimal = function() | ||
g.server:exec(function() | ||
local dec = '111111111111111111111111111111111111111.0' | ||
local sql = ([[SELECT %s;]]):format(dec) | ||
local exp = ([[Invalid decimal: '%s']]):format(dec) | ||
local res, err = box.execute(sql) | ||
t.assert(res == nil) | ||
t.assert_equals(err.message, exp) | ||
|
||
sql = ([[SELECT -%s;]]):format(dec) | ||
res, err = box.execute(sql) | ||
t.assert(res == nil) | ||
t.assert_equals(err.message, exp) | ||
end) | ||
end |