UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT
/test/10.9_opt_san/strings/ctype-simple.c:761:22: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
/test/10.9_dbg_san/strings/ctype-simple.c:761:22: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself
MDEV-28387UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
Closed
MDEV-31221UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32
This testcase produces a long list of other stacks across versions and opt/dbg. UniqueID's/stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|Item_result_field::save_in_result_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|copy_funcs
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Item::save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Type_handler_string_result::Item_save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Item::save_str_in_field
Roel Van de Paar
added a comment - This testcase produces a long list of other stacks across versions and opt/dbg. UniqueID's/stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|Item_result_field::save_in_result_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|copy_funcs
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Item::save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Type_handler_string_result::Item_save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Item::save_str_in_field
Which leads to the following new UniqueID's/stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item_func_concat::val_str|Type_handler::Item_send_str
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Item_func_concat::val_str
Note that the -9223372036854775808 value is very specific. Changing even the last digit from 8 to 0 will make the testcase fail to reproduce the bug.
Roel Van de Paar
added a comment - Additional testcase:
CREATE TABLE t (c TEXT, KEY (c)) ENGINE=MyISAM;
INSERT INTO t VALUES ( '-9223372036854775808' );
SELECT CONCAT (OCT(c)) FROM t;
Which leads to the following new UniqueID's/stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item_func_concat::val_str|Type_handler::Item_send_str
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Item_func_concat::val_str
Note that the -9223372036854775808 value is very specific. Changing even the last digit from 8 to 0 will make the testcase fail to reproduce the bug.
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value|Item::update_null_value
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value|Item_func::is_null
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value
Roel Van de Paar
added a comment -
DO OCT(-9223372036854775808);
Additional stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value|Item::update_null_value
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value|Item_func::is_null
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Type_handler_string_result::Item_update_null_value
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Type_handler::Item_send_str
Roel Van de Paar
added a comment -
CREATE TABLE t (c BLOB);
INSERT INTO t VALUES (1);
UPDATE t SET c= '-9223372036854775808/' ;
SELECT BIN(c) FROM t;
Additional stack:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Type_handler::Item_send_str
People
Alexander Barkov
Roel Van de Paar
Votes:
0Vote for this issue
Watchers:
1Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1106.2999999523163,"ttfb":225,"pageVisibility":"visible","entityId":110208,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"9dd47b30-d8dc-4aca-b3c0-efabbefb4b83","navigationType":0,"readyForUser":1229.6999998092651,"redirectCount":0,"resourceLoadedEnd":1217.3999998569489,"resourceLoadedStart":231.69999980926514,"resourceTiming":[{"duration":126.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":231.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":231.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":358.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":127.89999985694885,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":232,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":359.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":360.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":232.19999980926514,"connectEnd":232.19999980926514,"connectStart":232.19999980926514,"domainLookupEnd":232.19999980926514,"domainLookupStart":232.19999980926514,"fetchStart":232.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":372,"responseEnd":592.5999999046326,"responseStart":394.2999999523163,"secureConnectionStart":232.19999980926514},{"duration":521.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":232.39999985694885,"connectEnd":232.39999985694885,"connectStart":232.39999985694885,"domainLookupEnd":232.39999985694885,"domainLookupStart":232.39999985694885,"fetchStart":232.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":372.19999980926514,"responseEnd":754.1999998092651,"responseStart":395.59999990463257,"secureConnectionStart":232.39999985694885},{"duration":167.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":232.59999990463257,"connectEnd":232.59999990463257,"connectStart":232.59999990463257,"domainLookupEnd":232.59999990463257,"domainLookupStart":232.59999990463257,"fetchStart":232.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":372.39999985694885,"responseEnd":400.19999980926514,"responseStart":396.7999999523163,"secureConnectionStart":232.59999990463257},{"duration":171,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":232.69999980926514,"connectEnd":232.69999980926514,"connectStart":232.69999980926514,"domainLookupEnd":232.69999980926514,"domainLookupStart":232.69999980926514,"fetchStart":232.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":372.59999990463257,"responseEnd":403.69999980926514,"responseStart":399.59999990463257,"secureConnectionStart":232.69999980926514},{"duration":170.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":232.89999985694885,"connectEnd":232.89999985694885,"connectStart":232.89999985694885,"domainLookupEnd":232.89999985694885,"domainLookupStart":232.89999985694885,"fetchStart":232.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":372.7999999523163,"responseEnd":403.39999985694885,"responseStart":398.89999985694885,"secureConnectionStart":232.89999985694885},{"duration":131.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":233.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":233.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":364.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":170.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":233.29999995231628,"connectEnd":233.29999995231628,"connectStart":233.29999995231628,"domainLookupEnd":233.29999995231628,"domainLookupStart":233.29999995231628,"fetchStart":233.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":375.89999985694885,"responseEnd":404,"responseStart":400.59999990463257,"secureConnectionStart":233.29999995231628},{"duration":134.79999995231628,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":233.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":233.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":368.2999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":178.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":233.69999980926514,"connectEnd":233.69999980926514,"connectStart":233.69999980926514,"domainLookupEnd":233.69999980926514,"domainLookupStart":233.69999980926514,"fetchStart":233.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":377.2999999523163,"responseEnd":412.19999980926514,"responseStart":401.2999999523163,"secureConnectionStart":233.69999980926514},{"duration":612.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":240.39999985694885,"connectEnd":240.39999985694885,"connectStart":240.39999985694885,"domainLookupEnd":240.39999985694885,"domainLookupStart":240.39999985694885,"fetchStart":240.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":841.7999999523163,"responseEnd":853.1999998092651,"responseStart":852.5999999046326,"secureConnectionStart":240.39999985694885},{"duration":975.0999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":242.29999995231628,"connectEnd":242.29999995231628,"connectStart":242.29999995231628,"domainLookupEnd":242.29999995231628,"domainLookupStart":242.29999995231628,"fetchStart":242.29999995231628,"redirectEnd":0,"redirectStart":0,"requestStart":1205.3999998569489,"responseEnd":1217.3999998569489,"responseStart":1216.6999998092651,"secureConnectionStart":242.29999995231628},{"duration":274.2999999523163,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":736.8999998569489,"connectEnd":736.8999998569489,"connectStart":736.8999998569489,"domainLookupEnd":736.8999998569489,"domainLookupStart":736.8999998569489,"fetchStart":736.8999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":976.5999999046326,"responseEnd":1011.1999998092651,"responseStart":1010.5,"secureConnectionStart":736.8999998569489},{"duration":192.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1053.1999998092651,"connectEnd":1053.1999998092651,"connectStart":1053.1999998092651,"domainLookupEnd":1053.1999998092651,"domainLookupStart":1053.1999998092651,"fetchStart":1053.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":1211.5,"responseEnd":1245.6999998092651,"responseStart":1244.6999998092651,"secureConnectionStart":1053.1999998092651}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":29,"responseStart":225,"responseEnd":239,"domLoading":230,"domInteractive":1392,"domContentLoadedEventStart":1392,"domContentLoadedEventEnd":1440,"domComplete":2089,"loadEventStart":2089,"loadEventEnd":2090,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1352},{"name":"bigPipe.sidebar-id.end","time":1352.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":1353},{"name":"bigPipe.activity-panel-pipe-id.end","time":1364.1999998092651},{"name":"activityTabFullyLoaded","time":1461}],"measures":[],"correlationId":"441eab63afc744","effectiveType":"4g","downlink":9.2,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":11,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
This testcase produces a long list of other stacks across versions and opt/dbg. UniqueID's/stacks:
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|Item_result_field::save_in_result_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_in_field|copy_funcs
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Item::save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|Item_func_conv::val_str|Item::save_str_in_field|Type_handler_string_result::Item_save_in_field
UBSAN|negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself|strings/ctype-simple.c|my_strntoull_8bit|charset_info_st::strntoull|Item_func_conv::val_str|Item::save_str_in_field