I was having problems after upgrading my system. It was using libmysqlclient.so.18 and
now uses mariadb.so.3 as library to access the database. I started getting segfaults after
multiple queries to the database. I traced the execution down to mariadb_lib.c unpack_fields
function.
This function sets multiple char* and length fields. At the end (https://github.com/MariaDB/mariadb-connector-c/blob/3.1/libmariadb/mariadb_lib.c#L810), it handles the default_value
and set the "def" field accordingly. But there is the "def_length" field that should specify then
length of the string pointed by "def". It is not initialized in the function. The mysql Haskell
library uses this field to know the length of the string to copy internally. With a weird and
big enough number, the program cashes with a sigsegv.
default value and length are only used for api function
mysql_list_fields
however this function is marked as deprecated (and therefore not documented in our docs).
To retrieve the default value you should use SQL syntax "SHOW COLUMNS" or retrieve the information from information_schema
Georg Richter
added a comment - default value and length are only used for api function
mysql_list_fields
however this function is marked as deprecated (and therefore not documented in our docs).
To retrieve the default value you should use SQL syntax "SHOW COLUMNS" or retrieve the information from information_schema
The peekS function was calling memcpy to simply copy the char* as an Haskell ByteString. This will simply
be an empty string.
Thank you.
Sylvain Falardeau
added a comment - Having def=NULL and def_length=0 will be fine for the code in Haskell that was causing the problem:
https://github.com/paul-rouse/mysql/blob/master/Database/MySQL/Base/Types.hsc#L221
The peekS function was calling memcpy to simply copy the char* as an Haskell ByteString. This will simply
be an empty string.
Thank you.
People
Georg Richter
Sylvain Falardeau
Votes:
0Vote for this issue
Watchers:
2Start 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":964.5,"ttfb":338,"pageVisibility":"visible","entityId":72203,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"4922fe95-c5da-45c2-b229-50ea7000f676","navigationType":0,"readyForUser":1063.3000001907349,"redirectCount":0,"resourceLoadedEnd":686.6999998092651,"resourceLoadedStart":346.5,"resourceTiming":[{"duration":23,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":346.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":346.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":369.5,"responseStart":0,"secureConnectionStart":0},{"duration":24.199999809265137,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":346.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":346.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":371,"responseStart":0,"secureConnectionStart":0},{"duration":233.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":347,"connectEnd":347,"connectStart":347,"domainLookupEnd":347,"domainLookupStart":347,"fetchStart":347,"redirectEnd":0,"redirectStart":0,"requestStart":375.8999996185303,"responseEnd":580.0999994277954,"responseStart":396.5999994277954,"secureConnectionStart":347},{"duration":339.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":347.5,"connectEnd":347.5,"connectStart":347.5,"domainLookupEnd":347.5,"domainLookupStart":347.5,"fetchStart":347.5,"redirectEnd":0,"redirectStart":0,"requestStart":377,"responseEnd":686.6999998092651,"responseStart":398,"secureConnectionStart":347.5},{"duration":60.29999923706055,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":347.80000019073486,"connectEnd":347.80000019073486,"connectStart":347.80000019073486,"domainLookupEnd":347.80000019073486,"domainLookupStart":347.80000019073486,"fetchStart":347.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":377.5999994277954,"responseEnd":408.0999994277954,"responseStart":404.3999996185303,"secureConnectionStart":347.80000019073486},{"duration":62.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":347.8999996185303,"connectEnd":347.8999996185303,"connectStart":347.8999996185303,"domainLookupEnd":347.8999996185303,"domainLookupStart":347.8999996185303,"fetchStart":347.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":378.19999980926514,"responseEnd":410.19999980926514,"responseStart":405.30000019073486,"secureConnectionStart":347.8999996185303},{"duration":63.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":348.0999994277954,"connectEnd":348.0999994277954,"connectStart":348.0999994277954,"domainLookupEnd":348.0999994277954,"domainLookupStart":348.0999994277954,"fetchStart":348.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":378.5,"responseEnd":411.3999996185303,"responseStart":406.80000019073486,"secureConnectionStart":348.0999994277954},{"duration":27,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":348.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":348.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":375.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":63.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":348.3999996185303,"connectEnd":348.3999996185303,"connectStart":348.3999996185303,"domainLookupEnd":348.3999996185303,"domainLookupStart":348.3999996185303,"fetchStart":348.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":379.80000019073486,"responseEnd":411.69999980926514,"responseStart":408.30000019073486,"secureConnectionStart":348.3999996185303},{"duration":28.700000762939453,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":348.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":348.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":377.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":63.39999961853027,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":348.69999980926514,"connectEnd":348.69999980926514,"connectStart":348.69999980926514,"domainLookupEnd":348.69999980926514,"domainLookupStart":348.69999980926514,"fetchStart":348.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":380.0999994277954,"responseEnd":412.0999994277954,"responseStart":409.5,"secureConnectionStart":348.69999980926514},{"duration":326.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":352.8999996185303,"connectEnd":352.8999996185303,"connectStart":352.8999996185303,"domainLookupEnd":352.8999996185303,"domainLookupStart":352.8999996185303,"fetchStart":352.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":462.30000019073486,"responseEnd":679.5,"responseStart":675.3000001907349,"secureConnectionStart":352.8999996185303},{"duration":331.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":354.5999994277954,"connectEnd":354.5999994277954,"connectStart":354.5999994277954,"domainLookupEnd":354.5999994277954,"domainLookupStart":354.5999994277954,"fetchStart":354.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":514.8999996185303,"responseEnd":685.6999998092651,"responseStart":682,"secureConnectionStart":354.5999994277954},{"duration":145.20000076293945,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":724.0999994277954,"connectEnd":724.0999994277954,"connectStart":724.0999994277954,"domainLookupEnd":724.0999994277954,"domainLookupStart":724.0999994277954,"fetchStart":724.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":834.6999998092651,"responseEnd":869.3000001907349,"responseStart":868.5,"secureConnectionStart":724.0999994277954}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":130,"responseStart":339,"responseEnd":355,"domLoading":342,"domInteractive":1116,"domContentLoadedEventStart":1117,"domContentLoadedEventEnd":1159,"domComplete":1748,"loadEventStart":1748,"loadEventEnd":1748,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1093.3000001907349},{"name":"bigPipe.sidebar-id.end","time":1094.0999994277954},{"name":"bigPipe.activity-panel-pipe-id.start","time":1094.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.end","time":1095.5999994277954},{"name":"activityTabFullyLoaded","time":1175.5999994277954}],"measures":[],"correlationId":"387a8acb940572","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":127,"dbReadsTimeInMs":20,"dbConnsTimeInMs":28,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
default value and length are only used for api function
mysql_list_fields
To retrieve the default value you should use SQL syntax "SHOW COLUMNS" or retrieve the information from information_schema