DeNA / HandlerSocket-Plugin-for-MySQL

HandlerSocket is a NoSQL plugin for MySQL, working as a daemon inside the mysqld process, to accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries; instead it supports simple CRUD operations on tables.
Other
1.13k stars 150 forks source link

Mysqld may crash when inserting a row with value length less than fields length #78

Open skyinfall opened 12 years ago

skyinfall commented 12 years ago

modify t1 column to varchar(255) default null, mysqld won't crash, but result is sth like below:

select * from test.test;
+-----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id  | t1                                                                                                                                                                                                                                                     |
+-----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 321 | +       1       321
st PRIMARY id,t1    Y id,t1                                                                                                                                                                                                                 |
+-----+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

skyinfall commented 12 years ago

It seems caused by commit ca9c8784197835290e134007b9c52ea5f1ab02ce

    fixed a inconsistency between protocol.txt and the actual code. protocol.txt
    says that columns to be inserted are specified by open_index, but the code
    has ignored it.

To fix it, handlersocket/database.cpp line 663

ahiguti commented 12 years ago

reproduced and fixed. thanks a lot.