[MDEV-30401] Bitmap type - Shifting 64-bit value by 64 bits is undefined (cppcheck) Created: 2023-01-13 Updated: 2023-01-16 Resolved: 2023-01-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.5.18 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Daniel Black | Assignee: | Vladislav Vaintroub |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
This is a cppcheck found item. Seems to be valid. Not 100% sure.
What this doesn't show is sql_bitmask.h:77
So last_element_mask(width) - results in bit_mask(width) which misses the DBUG_ASSERT(n < width) in production builds. This would get called in:
(and myisam in same way). |
| Comments |
| Comment by Vladislav Vaintroub [ 2023-01-13 ] |
|
Nope, not valid. mariadb-server-10.11/sql/sql_bitmap.h:78:39: error: Shifting 64-bit value by 64 bits is undefined behaviour [shiftTooManyBits] Alleged error happens if ARRAY_ELEMENTS == 1, only but the caller has the condition if (ARRAY_ELEMENTS > 1) on previous line 189 |
| Comment by Daniel Black [ 2023-01-16 ] |
|
Thanks wlad, I was hoping I missed something obvious. Raised with cppcheck. |