mirror of
https://github.com/boostorg/regex.git
synced 2025-07-23 00:57:19 +02:00
Avoid generating pointers in writeable data section.
They increase memory consumption and make exploits easier and are completely unnecessary. Avoid them by either avoiding the pointer indirection completely by using char arrays for strings instead of char pointers, convert "static" pointer variables to simple local variables, or mark the array of pointers as const instead of just the things pointed to.
This commit is contained in:
committed by
Reimar Döffinger
parent
a550507517
commit
3168641320
@ -859,7 +859,7 @@ escape_type_class_jump:
|
||||
{
|
||||
bool have_brace = false;
|
||||
bool negative = false;
|
||||
static const char* incomplete_message = "Incomplete \\g escape found.";
|
||||
static const char incomplete_message[] = "Incomplete \\g escape found.";
|
||||
if(++m_position == m_end)
|
||||
{
|
||||
fail(regex_constants::error_escape, m_position - m_base, incomplete_message);
|
||||
@ -1133,7 +1133,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
|
||||
{
|
||||
static const char* incomplete_message = "Missing } in quantified repetition.";
|
||||
static const char incomplete_message[] = "Missing } in quantified repetition.";
|
||||
//
|
||||
// parse a repeat-range:
|
||||
//
|
||||
@ -1339,7 +1339,7 @@ bool basic_regex_parser<charT, traits>::parse_alt()
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_set()
|
||||
{
|
||||
static const char* incomplete_message = "Character set declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
|
||||
static const char incomplete_message[] = "Character set declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
|
||||
++m_position;
|
||||
if(m_position == m_end)
|
||||
{
|
||||
@ -1431,7 +1431,7 @@ bool basic_regex_parser<charT, traits>::parse_set()
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, traits>& char_set)
|
||||
{
|
||||
static const char* incomplete_message = "Character class declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
|
||||
static const char incomplete_message[] = "Character class declaration starting with [ terminated prematurely - either no ] was found or the set had no content.";
|
||||
//
|
||||
// we have either a character class [:name:]
|
||||
// a collating element [.name.]
|
||||
|
@ -208,8 +208,8 @@ int get_default_class_id(const charT* p1, const charT* p2)
|
||||
{data+63, data+67,}, // word
|
||||
{data+67, data+73,}, // xdigit
|
||||
};
|
||||
static const character_pointer_range<charT>* ranges_begin = ranges;
|
||||
static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
|
||||
const character_pointer_range<charT>* ranges_begin = ranges;
|
||||
const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
|
||||
|
||||
character_pointer_range<charT> t = { p1, p2, };
|
||||
const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);
|
||||
|
Reference in New Issue
Block a user