Skip to content

Commit f14aff2

Browse files
committed
Bug#20600847: COMP_ERR CRASHES WHEN ADDING MORE ERROR MESSAGES
The number of error messages has exceeded 1000, but comp_err is only prepared for 1000 messages. This causes crashes at build time on some platforms. Increase MAX_ROWS from 1000 to 2000 in extra/comp_err.c to allow up to 2000 error messages. Also add a check that prints an error message and exits, instead of crashing, if the number of error messages exceeds MAX_ROWS.
1 parent ed8ccc2 commit f14aff2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extra/comp_err.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include <my_dir.h>
3434
#include <mysql_version.h>
3535

36-
#define MAX_ROWS 1000
36+
#define MAX_ROWS 2000
3737
#define HEADER_LENGTH 32 /* Length of header in errmsg.sys */
3838
#define ERRMSG_VERSION 3 /* Version number of errmsg.sys */
3939
#define DEFAULT_CHARSET_DIR "../sql/share/charsets"
@@ -183,6 +183,12 @@ int main(int argc, char *argv[])
183183
fprintf(stderr, "Failed to parse input file %s\n", TXTFILE);
184184
DBUG_RETURN(1);
185185
}
186+
if (row_count > MAX_ROWS)
187+
{
188+
fprintf(stderr, "Found too many error messages. ");
189+
fprintf(stderr, "Increase MAX_ROWS in extra/comp_err.c.\n");
190+
DBUG_RETURN(1);
191+
}
186192
#if MYSQL_VERSION_ID >= 50100 && MYSQL_VERSION_ID < 50500
187193
/* Number of error messages in 5.1 - do not change this number! */
188194
#define MYSQL_OLD_GA_ERROR_MESSAGE_COUNT 641

0 commit comments

Comments
 (0)