Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
602b5e4c
Commit
602b5e4c
authored
Apr 18, 2017
by
Daniel Black
Committed by
Sergei Golubchik
May 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: global readonly variable pcre_frame_size
parent
b30311e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
1 deletion
+33
-1
include/my_sys.h
include/my_sys.h
+3
-0
mysys/my_init.c
mysys/my_init.c
+2
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+7
-1
sql/mysqld.cc
sql/mysqld.cc
+4
-0
sql/sql_parse.cc
sql/sql_parse.cc
+8
-0
sql/sql_parse.h
sql/sql_parse.h
+1
-0
sql/sys_vars.cc
sql/sys_vars.cc
+8
-0
No files found.
include/my_sys.h
View file @
602b5e4c
...
...
@@ -227,6 +227,9 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
myf
MyFlags
);
extern
uint
my_file_limit
;
extern
ulonglong
my_thread_stack_size
;
#ifndef EMBEDDED_LIBRARY
extern
ulonglong
my_pcre_frame_size
;
#endif
extern
int
sf_leaking_memory
;
/* set to 1 to disable memleak detection */
extern
void
(
*
proc_info_hook
)(
void
*
,
const
PSI_stage_info
*
,
PSI_stage_info
*
,
...
...
mysys/my_init.c
View file @
602b5e4c
...
...
@@ -45,6 +45,8 @@ my_bool my_init_done= 0;
uint
mysys_usage_id
=
0
;
/* Incremented for each my_init() */
ulonglong
my_thread_stack_size
=
(
sizeof
(
void
*
)
<=
4
)
?
65536
:
((
256
-
16
)
*
1024
);
/* http://pcre.org/original/doc/html/pcrestack.html - replaced by init_pcre value */
ulonglong
my_pcre_frame_size
=
640
+
16
;
static
ulong
atoi_octal
(
const
char
*
str
)
{
...
...
sql/item_cmpfunc.h
View file @
602b5e4c
...
...
@@ -25,6 +25,7 @@
#include "thr_malloc.h"
/* sql_calloc */
#include "item_func.h"
/* Item_int_func, Item_bool_func */
long
check_stack_available
(
long
margin
,
uchar
*
dummy
);
#define PCRE_STATIC 1
/* Important on Windows */
#include "pcre.h"
/* pcre header file */
...
...
@@ -1576,8 +1577,13 @@ class Regexp_processor_pcre
m_library_charset
(
&
my_charset_utf8_general_ci
),
m_subpatterns_needed
(
0
)
{
#ifndef EMBEDDED_LIBRARY
uchar
dummy
;
m_pcre_extra
.
flags
=
PCRE_EXTRA_MATCH_LIMIT_RECURSION
;
m_pcre_extra
.
match_limit_recursion
=
100L
;
m_pcre_extra
.
match_limit_recursion
=
check_stack_available
(
100
,
&
dummy
)
/
my_pcre_frame_size
;
#else
m_pcre_extra
.
flags
=
0L
;
#endif
}
int
default_regex_flags
();
void
init
(
CHARSET_INFO
*
data_charset
,
int
extra_flags
,
uint
nsubpatterns
)
...
...
sql/mysqld.cc
View file @
602b5e4c
...
...
@@ -100,6 +100,7 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
#include "sql_reload.h" // reload_acl_and_cache
#include "pcre.h"
#ifdef HAVE_POLL_H
#include <poll.h>
...
...
@@ -3503,6 +3504,9 @@ static void init_pcre()
pcre_free
=
pcre_stack_free
=
my_str_free_mysqld
;
#ifndef EMBEDDED_LIBRARY
pcre_stack_guard
=
check_enough_stack_size_slow
;
/* my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) + 16;
http://pcre.org/original/doc/html/pcrestack.html has reason for + 16
my_pcre_frame_size= -pcre_match(NULL, NULL, NULL, 0, NULL, NULL, 0) + 16; */
#endif
}
...
...
sql/sql_parse.cc
View file @
602b5e4c
...
...
@@ -6208,6 +6208,14 @@ bool check_stack_overrun(THD *thd, long margin,
return
0
;
}
long
check_stack_available
(
long
margin
,
uchar
*
buf
__attribute__
((
unused
)))
{
long
stack_top
;
DBUG_ASSERT
(
current_thd
);
return
my_thread_stack_size
-
margin
\
-
used_stack
(
current_thd
->
thread_stack
,(
char
*
)
&
stack_top
);
}
#define MY_YACC_INIT 1000 // Start with big alloc
#define MY_YACC_MAX 32000 // Because of 'short'
...
...
sql/sql_parse.h
View file @
602b5e4c
...
...
@@ -134,6 +134,7 @@ bool check_simple_select();
Item
*
normalize_cond
(
Item
*
cond
);
Item
*
negate_expression
(
THD
*
thd
,
Item
*
expr
);
bool
check_stack_overrun
(
THD
*
thd
,
long
margin
,
uchar
*
dummy
);
long
check_stack_available
(
long
margin
,
uchar
*
dummy
);
/* Variables */
...
...
sql/sys_vars.cc
View file @
602b5e4c
...
...
@@ -2493,6 +2493,14 @@ static Sys_var_ulonglong Sys_thread_stack(
VALID_RANGE
(
128
*
1024
,
ULONGLONG_MAX
),
DEFAULT
(
DEFAULT_THREAD_STACK
),
BLOCK_SIZE
(
1024
));
#ifndef EMBEDDED_LIBRARY
static
Sys_var_ulonglong
Sys_my_pcre_frame_size
(
"pcre_frame_size"
,
"Frame size for pcre_recursion"
,
GLOBAL_VAR
(
my_pcre_frame_size
),
NO_CMD_LINE
,
VALID_RANGE
(
500
,
1024
),
DEFAULT
(
640
+
16
),
1
,
NO_MUTEX_GUARD
,
NOT_IN_BINLOG
,
ON_CHECK
(
0
),
ON_UPDATE
(
0
));
#endif
static
Sys_var_charptr
Sys_tmpdir
(
"tmpdir"
,
"Path for temporary files. Several paths may "
"be specified, separated by a "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment