Avoid crash in JSON library for invalid UTF8

pull/2354/head
René Cannaò 7 years ago
parent 1ac092490d
commit 3ad899c758

@ -229,7 +229,7 @@ void MySQL_Event::write_auth(std::fstream *f, MySQL_Session *sess) {
// for performance reason, we are moving the write lock
// right before the write to disk
GloMyLogger->wrlock();
*f << j.dump() << std::endl;
*f << j.dump(-1, ' ', false, json::error_handler_t::replace) << std::endl;
}
uint64_t MySQL_Event::write_query_format_1(std::fstream *f) {
@ -402,7 +402,7 @@ uint64_t MySQL_Event::write_query_format_2_json(std::fstream *f) {
// right before the write to disk
GloMyLogger->wrlock();
*f << j.dump() << std::endl;
*f << j.dump(-1, ' ', false, json::error_handler_t::replace) << std::endl;
return total_bytes; // always 0
}

@ -1050,7 +1050,7 @@ void MySQL_Session::return_proxysql_internal(PtrSize_t *pkt) {
if (pkt->size==(5+l) && strncasecmp((char *)"PROXYSQL INTERNAL SESSION", (char *)pkt->ptr+5, l)==0) {
json j;
generate_proxysql_internal_session_json(j);
std::string s = j.dump(4);
std::string s = j.dump(4, ' ', false, json::error_handler_t::replace);
SQLite3_result *resultset = new SQLite3_result(1);
resultset->add_column_definition(SQLITE_TEXT,"session_info");
char *pta[1];

@ -5564,10 +5564,10 @@ SQLite3_result * MySQL_Threads_Handler::SQL3_Processlist() {
json j;
sess->generate_proxysql_internal_session_json(j);
if (mysql_thread___show_processlist_extended == 2) {
std::string s = j.dump(4);
std::string s = j.dump(4, ' ', false, json::error_handler_t::replace);
pta[15] = strdup(s.c_str());
} else {
std::string s = j.dump();
std::string s = j.dump(-1, ' ', false, json::error_handler_t::replace);
pta[15] = strdup(s.c_str());
}
}

Loading…
Cancel
Save