Added MAX_EVENT_TYPE_MARIADB10 check

Added MAX_EVENT_TYPE_MARIADB10 check  for router->mariadb10_compat
This commit is contained in:
MassimilianoPinto
2015-05-07 17:02:33 +02:00
parent 2c2a03a6f6
commit 7d48779913
2 changed files with 19 additions and 7 deletions

View File

@ -397,7 +397,8 @@ static char *blrs_states[] = { "Created", "Unregistered", "Registered",
#define ANONYMOUS_GTID_EVENT 0x22 #define ANONYMOUS_GTID_EVENT 0x22
#define PREVIOUS_GTIDS_EVENT 0x23 #define PREVIOUS_GTIDS_EVENT 0x23
#define MAX_EVENT_TYPE 0xa3 #define MAX_EVENT_TYPE 0x23
#define MAX_EVENT_TYPE_MARIADB10 0xa3
/** /**
* Binlog event flags * Binlog event flags

View File

@ -443,15 +443,26 @@ struct stat statb;
hdr->next_pos = EXTRACT32(&hdbuf[13]); hdr->next_pos = EXTRACT32(&hdbuf[13]);
hdr->flags = EXTRACT16(&hdbuf[17]); hdr->flags = EXTRACT16(&hdbuf[17]);
if (hdr->event_type > MAX_EVENT_TYPE) if (router->mariadb10_compat) {
{ if (hdr->event_type > MAX_EVENT_TYPE_MARIADB10) {
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR, LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Invalid event type 0x%x. " "Invalid MariaDB 10 event type 0x%x. "
"Binlog file is %s, position %d", "Binlog file is %s, position %d",
hdr->event_type, hdr->event_type,
file->binlogname, pos))); file->binlogname, pos)));
return NULL; return NULL;
} }
} else {
if (hdr->event_type > MAX_EVENT_TYPE) {
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Invalid event type 0x%x. "
"Binlog file is %s, position %d",
hdr->event_type,
file->binlogname, pos)));
return NULL;
}
}
if (hdr->next_pos < pos && hdr->event_type != ROTATE_EVENT) if (hdr->next_pos < pos && hdr->event_type != ROTATE_EVENT)
{ {