Add missing verify*** transformation statements to parser

This commit is contained in:
Victor Hora 2018-03-04 17:04:03 -05:00 committed by Felipe Zimmerle
parent 8bb64c3ee3
commit a66acebc05
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
4 changed files with 892 additions and 944 deletions

View File

@ -1,6 +1,8 @@
v3.0.x - YYYY-MMM-DD (To be released)
-------------------------------------
- Add missing verify*** transformation statements to parser
[Issue #1006 and #1007 - @victorhora]
- Fix a set of compilation warnings
[Issue #1650 - @zimmerle, @JayCase]
- Check for disruptive action on SecDefaultAction.

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
// A Bison parser, made by GNU Bison 3.0.4.
// A Bison parser, made by GNU Bison 3.0.2.
// Skeleton interface for Bison LALR(1) parsers in C++
// Copyright (C) 2002-2015 Free Software Foundation, Inc.
// Copyright (C) 2002-2013 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@
#ifndef YY_YY_SECLANG_PARSER_HH_INCLUDED
# define YY_YY_SECLANG_PARSER_HH_INCLUDED
// // "%code requires" blocks.
#line 10 "seclang-parser.yy" // lalr1.cc:377
#line 10 "seclang-parser.yy" // lalr1.cc:372
#include <string>
#include <iterator>
@ -378,14 +378,13 @@ using modsecurity::operators::Operator;
#line 382 "seclang-parser.hh" // lalr1.cc:377
#line 382 "seclang-parser.hh" // lalr1.cc:372
# include <cassert>
# include <cstdlib> // std::abort
# include <vector>
# include <iostream>
# include <stdexcept>
# include <string>
# include <vector>
# include "stack.hh"
# include "location.hh"
#include <typeinfo>
@ -455,7 +454,7 @@ using modsecurity::operators::Operator;
namespace yy {
#line 459 "seclang-parser.hh" // lalr1.cc:377
#line 458 "seclang-parser.hh" // lalr1.cc:372
@ -472,13 +471,13 @@ namespace yy {
/// Empty construction.
variant ()
: yytypeid_ (YY_NULLPTR)
: yytname_ (YY_NULLPTR)
{}
/// Construct and fill.
template <typename T>
variant (const T& t)
: yytypeid_ (&typeid (T))
: yytname_ (typeid (T).name ())
{
YYASSERT (sizeof (T) <= S);
new (yyas_<T> ()) T (t);
@ -487,7 +486,7 @@ namespace yy {
/// Destruction, allowed only if empty.
~variant ()
{
YYASSERT (!yytypeid_);
YYASSERT (!yytname_);
}
/// Instantiate an empty \a T in here.
@ -495,9 +494,9 @@ namespace yy {
T&
build ()
{
YYASSERT (!yytypeid_);
YYASSERT (!yytname_);
YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);
yytname_ = typeid (T).name ();
return *new (yyas_<T> ()) T;
}
@ -506,9 +505,9 @@ namespace yy {
T&
build (const T& t)
{
YYASSERT (!yytypeid_);
YYASSERT (!yytname_);
YYASSERT (sizeof (T) <= S);
yytypeid_ = & typeid (T);
yytname_ = typeid (T).name ();
return *new (yyas_<T> ()) T (std::move((T&)t));
}
@ -517,7 +516,7 @@ namespace yy {
T&
as ()
{
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (yytname_ == typeid (T).name ());
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
}
@ -527,7 +526,7 @@ namespace yy {
const T&
as () const
{
YYASSERT (*yytypeid_ == typeid (T));
YYASSERT (yytname_ == typeid (T).name ());
YYASSERT (sizeof (T) <= S);
return *yyas_<T> ();
}
@ -544,8 +543,8 @@ namespace yy {
void
swap (self_type& other)
{
YYASSERT (yytypeid_);
YYASSERT (*yytypeid_ == *other.yytypeid_);
YYASSERT (yytname_);
YYASSERT (yytname_ == other.yytname_);
std::swap (as<T> (), other.as<T> ());
}
@ -575,7 +574,7 @@ namespace yy {
destroy ()
{
as<T> ().~T ();
yytypeid_ = YY_NULLPTR;
yytname_ = YY_NULLPTR;
}
private:
@ -610,7 +609,7 @@ namespace yy {
} yybuffer_;
/// Whether the content is built: if defined, the name of the stored type.
const std::type_info *yytypeid_;
const char *yytname_;
};
@ -1153,12 +1152,9 @@ namespace yy {
/// (External) token type, as returned by yylex.
typedef token::yytokentype token_type;
/// Symbol type: an internal symbol number.
/// Internal symbol number.
typedef int symbol_number_type;
/// The symbol type number to denote an empty symbol.
enum { empty_symbol = -2 };
/// Internal symbol number for tokens (subsumed by symbol_number_type).
typedef unsigned short int token_number_type;
@ -1204,15 +1200,8 @@ namespace yy {
const semantic_type& v,
const location_type& l);
/// Destroy the symbol.
~basic_symbol ();
/// Destroy contents, and record that is empty.
void clear ();
/// Whether empty.
bool empty () const;
/// Destructive move, \a s is emptied into this.
void move (basic_symbol& s);
@ -1242,23 +1231,21 @@ namespace yy {
/// Constructor from (external) token numbers.
by_type (kind_type t);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that.
void move (by_type& that);
/// The (internal) type number (corresponding to \a type).
/// \a empty when empty.
/// -1 when this symbol is empty.
symbol_number_type type_get () const;
/// The token.
token_type token () const;
enum { empty = 0 };
/// The symbol type.
/// \a empty_symbol when empty.
/// An int, not token_number_type, to be able to store empty_symbol.
int type;
/// -1 when this symbol is empty.
token_number_type type;
};
/// "External" symbols: returned by the scanner.
@ -2546,9 +2533,9 @@ namespace yy {
/// Generate an error message.
/// \param yystate the state where the error occurred.
/// \param yyla the lookahead token.
/// \param yytoken the lookahead token type, or yyempty_.
virtual std::string yysyntax_error_ (state_type yystate,
const symbol_type& yyla) const;
symbol_number_type yytoken) const;
/// Compute post-reduction state.
/// \param yystate the current state
@ -2651,21 +2638,16 @@ namespace yy {
/// Copy constructor.
by_state (const by_state& other);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol type from \a that.
void move (by_state& that);
/// The (internal) type number (corresponding to \a state).
/// \a empty_symbol when empty.
/// "empty" when empty.
symbol_number_type type_get () const;
/// The state number used to denote an empty symbol.
enum { empty_state = -1 };
enum { empty = 0 };
/// The state.
/// \a empty when empty.
state_type state;
};
@ -2706,12 +2688,13 @@ namespace yy {
/// Pop \a n symbols the three stacks.
void yypop_ (unsigned int n = 1);
/// Constants.
// Constants.
enum
{
yyeof_ = 0,
yylast_ = 3094, ///< Last index in yytable_.
yynnts_ = 15, ///< Number of nonterminal symbols.
yyempty_ = -2,
yyfinal_ = 297, ///< Termination state number.
yyterror_ = 1,
yyerrcode_ = 256,
@ -3310,19 +3293,9 @@ namespace yy {
template <typename Base>
inline
seclang_parser::basic_symbol<Base>::~basic_symbol ()
{
clear ();
}
template <typename Base>
inline
void
seclang_parser::basic_symbol<Base>::clear ()
{
// User destructor.
symbol_number_type yytype = this->type_get ();
basic_symbol<Base>& yysym = *this;
(void) yysym;
switch (yytype)
{
default:
@ -3537,15 +3510,6 @@ namespace yy {
break;
}
Base::clear ();
}
template <typename Base>
inline
bool
seclang_parser::basic_symbol<Base>::empty () const
{
return Base::type_get () == empty_symbol;
}
template <typename Base>
@ -3767,7 +3731,7 @@ namespace yy {
// by_type.
inline
seclang_parser::by_type::by_type ()
: type (empty_symbol)
: type (empty)
{}
inline
@ -3780,19 +3744,12 @@ namespace yy {
: type (yytranslate_ (t))
{}
inline
void
seclang_parser::by_type::clear ()
{
type = empty_symbol;
}
inline
void
seclang_parser::by_type::move (by_type& that)
{
type = that.type;
that.clear ();
that.type = empty;
}
inline
@ -5711,7 +5668,7 @@ namespace yy {
} // yy
#line 5715 "seclang-parser.hh" // lalr1.cc:377
#line 5672 "seclang-parser.hh" // lalr1.cc:372

View File

@ -956,13 +956,11 @@ op_before_init:
}
| OPERATOR_VERIFY_CPF run_time_string
{
/* $$ = new operators::VerifyCPF($1); */
OPERATOR_NOT_SUPPORTED("VerifyCPF", @0);
OPERATOR_CONTAINER($$, new operators::VerifyCPF(std::move($2)));
}
| OPERATOR_VERIFY_SSN run_time_string
{
/* $$ = new operators::VerifySSN($1); */
OPERATOR_NOT_SUPPORTED("VerifySSN", @0);
OPERATOR_CONTAINER($$, new operators::VerifySSN(std::move($2)));
}
| OPERATOR_GSB_LOOKUP run_time_string
{