Description:
i am reading source code of plugin/innodb_memcached in version 5.7.4 now.
When i read innodb_api_copy_mci() function in plugin/innodb_memcached/innodb_memcache/src/innodb_api.c file, i found a bug.
# cat -n innodb_api.c
621 static
622 bool
623 innodb_api_copy_mci(
624 /*================*/
...
633 data_len = ib_cb_col_get_meta(read_tpl, col_id, &col_meta);
634
635 if (data_len == IB_SQL_NULL) {
636 mci_item->value_str = NULL;
637 mci_item->value_len = 0;
638 mci_item->allocated = false;
639 } else {
640 if (col_meta.type == IB_INT) {
641 mci_item->value_str = malloc(50);
642 memset(mci_item->value_str, 0, 50);
643
...
667 } else {
...
674 mci_item->allocated = true;
675 memcpy(mci_item->value_str,
676 ib_cb_col_get_value(read_tpl, col_id),
677 data_len);
678 mci_item->value_len = data_len;
679 }
680 }
681
x 682 mci_item->is_str = true;
683 mci_item->is_valid = true;
684
685 return(true);
686 }
i think this code is always mci_item->is_str set true, when int_value and value_string. This is no good.
How to repeat:
i cann't repeat, but i think the following are righter.
621 static
622 bool
623 innodb_api_copy_mci(
624 /*================*/
...
633 data_len = ib_cb_col_get_meta(read_tpl, col_id, &col_meta);
634
635 if (data_len == IB_SQL_NULL) {
636 mci_item->value_str = NULL;
637 mci_item->value_len = 0;
638 mci_item->allocated = false;
639 } else {
640 if (col_meta.type == IB_INT) {
641 mci_item->value_str = malloc(50);
642 memset(mci_item->value_str, 0, 50);
643
...
o mci_item->is_str = false; //added
667 } else {
...
674 mci_item->allocated = true;
675 memcpy(mci_item->value_str,
676 ib_cb_col_get_value(read_tpl, col_id),
677 data_len);
678 mci_item->value_len = data_len;
o mci_item->is_str = true; //added
679 }
680 }
681
x 682// mci_item->is_str = true; //commented or blank line
683 mci_item->is_valid = true;
684
685 return(true);
686 }