[MCOL-1132] Unsigned Integer overflow for negative value instead of 0 Created: 2018-01-03 Updated: 2023-10-26 Resolved: 2018-01-03 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Icebox |
| Type: | Bug | Priority: | Major |
| Reporter: | Jens Röwekamp (Inactive) | Assignee: | Andrew Hutchings (Inactive) |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Debian 9 |
||
| Description |
|
Inserting a negative integer through the columnstore API which is mapped to a unsigned integer field results in a positive result instead of 0. If inserting the same value through SQL it is masked to 0. Reproducible by changing lines 73 and 92 of dataconvert-int.cpp to: bulk->setColumn(2, (uint64_t) -1); and ASSERT_STREQ(row[2], "0"); |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2018-01-03 ] | |||||
|
This is a good point, but is not really a bug, I'll explain why... When you do "(uint64_t) -1" the C++ compiler converts at compile time to 18446744073709551615. You can see this in the objdump of the binary:
So you are effectively doing in code:
The value in the double column is set to 18446744073709551615 so this is correct behaviour. |