Bug #73964 | unhex() runtime error: left shift of negative value -1 | ||
---|---|---|---|
Submitted: | 18 Sep 2014 7:27 | Modified: | 21 Jan 2016 22:49 |
Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.7.6 | OS: | Any (x64) |
Assigned to: | CPU Architecture: | Any | |
Tags: | asan, shift, UNHEX |
[18 Sep 2014 7:27]
Shane Bester
[21 Sep 2014 18:58]
MySQL Verification Team
simple fix: === modified file 'sql/item_strfunc.cc' --- sql/item_strfunc.cc 2014-09-12 14:42:43 +0000 +++ sql/item_strfunc.cc 2014-09-21 17:47:43 +0000 @@ -4752,9 +4752,10 @@ for (end=res->ptr()+res->length(); from < end ; from+=2, to++) { int hex_char; - *to= (hex_char= hexchar_to_int(from[0])) << 4; + hex_char= hexchar_to_int(from[0]); if ((null_value= (hex_char == -1))) return 0; + *to= hex_char << 4; *to|= hex_char= hexchar_to_int(from[1]); if ((null_value= (hex_char == -1))) return 0;
[21 Jan 2016 22:49]
Paul DuBois
Noted in 5.7.12, 5.8.0 changelogs. UNHEX() could attempt a left shift by a negative number of bits.
[21 Jan 2016 22:51]
Paul DuBois
Correction: UNHEX() could attempt a left shift of a negative number.