payload: {"action":"opened","issue":{"url":"https://api.github.com/repos/tarantool/mysql/issues/39","repository_url":"https://api.github.com/repos/tarantool/mysql","labels_url":"https://api.github.com/repos/tarantool/mysql/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/tarantool/mysql/issues/39/comments","events_url":"https://api.github.com/repos/tarantool/mysql/issues/39/events","html_url":"https://github.com/tarantool/mysql/issues/39","id":527928761,"node_id":"MDU6SXNzdWU1Mjc5Mjg3NjE=","number":39,"title":"Prepared statements with fields longtext and longblob make segmentation fault","user":{"login":"iMega","id":1487719,"node_id":"MDQ6VXNlcjE0ODc3MTk=","avatar_url":"https://avatars2.githubusercontent.com/u/1487719?v=4","gravatar_id":"","url":"https://api.github.com/users/iMega","html_url":"https://github.com/iMega","followers_url":"https://api.github.com/users/iMega/followers","following_url":"https://api.github.com/users/iMega/following{/other_user}","gists_url":"https://api.github.com/users/iMega/gists{/gist_id}","starred_url":"https://api.github.com/users/iMega/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iMega/subscriptions","organizations_url":"https://api.github.com/users/iMega/orgs","repos_url":"https://api.github.com/users/iMega/repos","events_url":"https://api.github.com/users/iMega/events{/privacy}","received_events_url":"https://api.github.com/users/iMega/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-11-25T08:31:45Z","updated_at":"2019-11-25T08:31:45Z","closed_at":null,"author_association":"NONE","body":"Problem: prepared statements with fields longtext and longblob cause segmentation fault if fields value is not equal NULL.\r\n\r\nmysql dump\r\n```sql\r\nCREATE TABLE `mytable` (\r\n  `pri` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n  `f_longtext` longtext NOT NULL,\r\n  `f_longtext_null` longtext DEFAULT NULL,\r\n  `f_longblob` longblob NOT NULL,\r\n  `f_longblob_null` longblob DEFAULT NULL,\r\n  PRIMARY KEY (`pri`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\r\nINSERT INTO `mytable` (`pri`, `f_longtext`, `f_longtext_null`, `f_longblob`, `f_longblob_null`)\r\nVALUES\r\n\t(1, '', NULL, '', NULL),\r\n\t(2, 'qwe', 'qwe', 'qwe', 'qwe');\r\n```\r\n\r\n```\r\ntmlapp        | Segmentation fault\r\ntmlapp        |   code: SEGV_MAPERR\r\ntmlapp        |   addr: 0\r\ntmlapp        |   context: 0x7f8cb387f6c0\r\ntmlapp        |   siginfo: 0x7f8cb387f7f0\r\ntmlapp        |   rax      0x0                0\r\ntmlapp        |   rbx      0x5601c2a2c2f8     94565560402680\r\ntmlapp        |   rcx      0x0                0\r\ntmlapp        |   rdx      0x3                3\r\ntmlapp        |   rsi      0x5601c2a07063     94565560250467\r\ntmlapp        |   rdi      0x0                0\r\ntmlapp        |   rsp      0x7f8cb387fd78     140242284182904\r\ntmlapp        |   rbp      0x3                3\r\ntmlapp        |   r8       0x1                1\r\ntmlapp        |   r9       0x0                0\r\ntmlapp        |   r10      0x40dcb718         1088206616\r\ntmlapp        |   r11      0x9                9\r\ntmlapp        |   r12      0x3                3\r\ntmlapp        |   r13      0x5601c2a2a600     94565560395264\r\ntmlapp        |   r14      0x0                0\r\ntmlapp        |   r15      0x5601c2a07061     94565560250465\r\ntmlapp        |   rip      0x7f8d1ba4b0a0     140244030894240\r\ntmlapp        |   eflags   0x10206            66054\r\ntmlapp        |   cs       0x33               51\r\ntmlapp        |   gs       0x0                0\r\ntmlapp        |   fs       0x0                0\r\ntmlapp        |   cr2      0x0                0\r\ntmlapp        |   err      0x6                6\r\ntmlapp        |   oldmask  0x0                0\r\ntmlapp        |   trapno   0xe                14\r\ntmlapp        | Current time: 1574495001\r\ntmlapp        | Please file a bug at http://github.com/tarantool/tarantool/issues\r\ntmlapp        | Attempting backtrace... Note: since the server has already crashed,\r\ntmlapp        | this may fail as well\r\ntmlapp        | #0  0x5601c1c7d219 in print_backtrace+9\r\ntmlapp        | #1  0x5601c1b68dda in _ZL12sig_fatal_cbiP9siginfo_tPv+ca\r\ntmlapp        | #2  0x7f8d1ba40e17 in sigwaitinfo+8\r\n```\r\n\r\n### Reproduce case:\r\n```\r\ntarantool> mysql = require(\"mysql\")\r\n---\r\n...\r\ntarantool> pool = mysql.pool_create({host = 'localhost', db = 'test', size = 5})\r\n---\r\n...\r\ntarantool> conn = pool:get()\r\n---\r\n...\r\ntarantool> conn:execute(\"select `f_longtext` from mytable where pri = ?\", 1)\r\n---\r\n- error: null  <-- crash\r\n...\r\ntarantool> conn:execute(\"select `f_longblob` from mytable where pri = ?\", 1)\r\n---\r\n- error: null  <-- crash\r\n...\r\ntarantool> conn:execute(\"select `f_longtext_null` from mytable where pri = ?\", 2)\r\n---\r\n- error: null  <-- crash\r\n...\r\ntarantool> conn:execute(\"select `f_longblob_null` from mytable where pri = ?\", 2)\r\n---\r\n- error: null  <-- crash\r\n...\r\n```\r\n\r\n### working cases\r\n```\r\ntarantool> conn:execute(\"select `f_longtext` from mytable where pri = 1\") <-- without prepare\r\ntarantool> conn:execute(\"select `f_longtext_null` from mytable where pri = ?\", 1) <-- if NULL\r\ntarantool> conn:execute(\"select `f_longblob_null` from mytable where pri = ?\", 1) <-- if NULL\r\n```\r\n\r\nmy working example with mariadb-connector-c https://github.com/iMega/tarantool-mysql-learning/blob/master/mysqltest/main.c\r\n\r\napp crashes here https://github.com/tarantool/mariadb-connector-c/blob/c5dfd891257f4dca3d1f6aa7645d27f6b491c6a6/libmariadb/mariadb_stmt.c#L1253\r\n"}}
other: {"actor":{"display_login":"iMega"}}