mirror of
https://github.com/VirusTotal/yara.git
synced 2026-10-11 22:49:58 +00:00
Spelling (#582)
* spelling: additionally * spelling: aggressively * spelling: alignment * spelling: analyzed * spelling: approximately * spelling: beginning * spelling: chosen * spelling: compiled * spelling: containing * spelling: contiguous * spelling: definitions * spelling: delimit * spelling: executable * spelling: explicit * spelling: explicitly * spelling: external * spelling: guaranteed * spelling: identified * spelling: initialization * spelling: initialize * spelling: initializing * spelling: insensitive * spelling: instruction * spelling: insufficient * spelling: maximum * spelling: numbers * spelling: possible * spelling: processor * spelling: provided * spelling: referring * spelling: require * spelling: restructuring * spelling: seventh * spelling: simultaneously * spelling: snippet * spelling: unknown
This commit is contained in:
committed by
Victor M. Alvarez
parent
779b9a77aa
commit
6fd48837b9
@@ -148,17 +148,17 @@ void args_print_error(
|
||||
{
|
||||
switch(error)
|
||||
{
|
||||
case ARGS_ERROR_UKNOWN_OPT:
|
||||
case ARGS_ERROR_UNKNOWN_OPT:
|
||||
fprintf(stderr, "unknown option `%s`\n", option);
|
||||
break;
|
||||
case ARGS_ERROR_TOO_MANY:
|
||||
fprintf(stderr, "too many `%s` options\n", option);
|
||||
break;
|
||||
case ARGS_ERROR_REQUIRED_INTEGER_ARG:
|
||||
fprintf(stderr, "option `%s` requieres an integer argument\n", option);
|
||||
fprintf(stderr, "option `%s` requires an integer argument\n", option);
|
||||
break;
|
||||
case ARGS_ERROR_REQUIRED_STRING_ARG:
|
||||
fprintf(stderr, "option `%s` requieres a string argument\n", option);
|
||||
fprintf(stderr, "option `%s` requires a string argument\n", option);
|
||||
break;
|
||||
case ARGS_ERROR_UNEXPECTED_ARG:
|
||||
fprintf(stderr, "option `%s` doesn't expect an argument\n", option);
|
||||
@@ -198,7 +198,7 @@ int args_parse(
|
||||
}
|
||||
else
|
||||
{
|
||||
error = ARGS_ERROR_UKNOWN_OPT;
|
||||
error = ARGS_ERROR_UNKNOWN_OPT;
|
||||
}
|
||||
}
|
||||
else if (args_is_short_arg(arg))
|
||||
@@ -230,7 +230,7 @@ int args_parse(
|
||||
}
|
||||
else
|
||||
{
|
||||
error = ARGS_ERROR_UKNOWN_OPT;
|
||||
error = ARGS_ERROR_UNKNOWN_OPT;
|
||||
}
|
||||
|
||||
if (error != ARGS_ERROR_OK)
|
||||
|
||||
@@ -40,7 +40,7 @@ extern "C" {
|
||||
|
||||
typedef enum _args_error_type {
|
||||
ARGS_ERROR_OK,
|
||||
ARGS_ERROR_UKNOWN_OPT,
|
||||
ARGS_ERROR_UNKNOWN_OPT,
|
||||
ARGS_ERROR_TOO_MANY,
|
||||
ARGS_ERROR_REQUIRED_INTEGER_ARG,
|
||||
ARGS_ERROR_REQUIRED_STRING_ARG,
|
||||
@@ -95,7 +95,7 @@ int args_parse(
|
||||
|
||||
void args_print_usage(
|
||||
args_option_t *options,
|
||||
int aligment);
|
||||
int alignment);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+15
-15
@@ -2,16 +2,16 @@
|
||||
The C API
|
||||
*********
|
||||
|
||||
You can integrate YARA into your C/C++ project by using the API privided by the
|
||||
You can integrate YARA into your C/C++ project by using the API provided by the
|
||||
*libyara* library. This API gives you access to every YARA feature and it's the
|
||||
same API used by the command-line tools ``yara`` and ``yarac``.
|
||||
|
||||
Initalizing and finalizing *libyara*
|
||||
Initializing and finalizing *libyara*
|
||||
====================================
|
||||
|
||||
The first thing your program must do when using *libyara* is initializing the
|
||||
library. This is done by calling the :c:func:`yr_initialize()` function. This
|
||||
function allocates any resources needed by the library and initalizes internal
|
||||
function allocates any resources needed by the library and initializes internal
|
||||
data structures. Its counterpart is :c:func:`yr_finalize`, which must be called
|
||||
when you are finished using the library.
|
||||
|
||||
@@ -208,7 +208,7 @@ All ``yr_rules_scan_XXXX`` functions receive a ``flags`` argument and a
|
||||
``timeout`` argument. The only flag defined at this time is
|
||||
``SCAN_FLAGS_FAST_MODE``, so you must pass either this flag or a zero value.
|
||||
The ``timeout`` argument forces the function to return after the specified
|
||||
number of seconds aproximately, with a zero meaning no timeout at all.
|
||||
number of seconds approximately, with a zero meaning no timeout at all.
|
||||
|
||||
The ``SCAN_FLAGS_FAST_MODE`` flag makes the scanning a little faster by avoiding
|
||||
multiple matches of the same string when not necessary. Once the string was
|
||||
@@ -352,7 +352,7 @@ Functions
|
||||
|
||||
.. c:function:: int yr_initialize(void)
|
||||
|
||||
Initalize the library. Must be called by the main thread before using any
|
||||
Initialize the library. Must be called by the main thread before using any
|
||||
other function. Return :c:macro:`ERROR_SUCCESS` on success another error
|
||||
code in case of error. The list of possible return codes vary according
|
||||
to the modules compiled into YARA.
|
||||
@@ -377,7 +377,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
.. c:function:: void yr_compiler_destroy(YR_COMPILER* compiler)
|
||||
|
||||
@@ -422,7 +422,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
.. c:function:: int yr_compiler_define_integer_variable(YR_COMPILER* compiler, const char* identifier, int64_t value)
|
||||
|
||||
@@ -468,7 +468,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
:c:macro:`ERROR_COULD_NOT_OPEN_FILE`
|
||||
|
||||
@@ -486,7 +486,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
:c:macro:`ERROR_INVALID_FILE`
|
||||
|
||||
@@ -500,7 +500,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
:c:macro:`ERROR_TOO_MANY_SCAN_THREADS`
|
||||
|
||||
@@ -517,7 +517,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
:c:macro:`ERROR_COULD_NOT_MAP_FILE`
|
||||
|
||||
@@ -542,7 +542,7 @@ Functions
|
||||
|
||||
:c:macro:`ERROR_SUCCESS`
|
||||
|
||||
:c:macro:`ERROR_INSUFICENT_MEMORY`
|
||||
:c:macro:`ERROR_INSUFFICIENT_MEMORY`
|
||||
|
||||
:c:macro:`ERROR_COULD_NOT_MAP_FILE`
|
||||
|
||||
@@ -647,9 +647,9 @@ Error codes
|
||||
|
||||
Everything went fine.
|
||||
|
||||
.. c:macro:: ERROR_INSUFICENT_MEMORY
|
||||
.. c:macro:: ERROR_INSUFFICIENT_MEMORY
|
||||
|
||||
Insuficient memory to complete the operation.
|
||||
Insufficient memory to complete the operation.
|
||||
|
||||
.. c:macro:: ERROR_COULD_NOT_OPEN_FILE
|
||||
|
||||
@@ -678,7 +678,7 @@ Error codes
|
||||
.. c:macro:: ERROR_TOO_MANY_SCAN_THREADS
|
||||
|
||||
Too many threads trying to use the same :c:type:`YR_RULES` object
|
||||
simultaneosly. The limit is defined by ``MAX_THREADS`` in
|
||||
simultaneously. The limit is defined by ``MAX_THREADS`` in
|
||||
*./include/yara/limits.h*
|
||||
|
||||
.. c:macro:: ERROR_SCAN_TIMEOUT
|
||||
|
||||
@@ -44,7 +44,7 @@ not. If you want to enforce the OpenSSL-dependant features you must pass
|
||||
``--with-crypto`` to the ``configure`` script. Ubuntu and Debian users can
|
||||
use ``sudo apt-get install libssl-dev`` to install the OpenSSL library.
|
||||
|
||||
The following modules are not copiled into YARA by default:
|
||||
The following modules are not compiled into YARA by default:
|
||||
|
||||
* cuckoo
|
||||
* magic
|
||||
|
||||
@@ -123,7 +123,7 @@ After the declaration section you'll find a pair of functions:
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
The ``module_initialize`` function is called during YARA's initializtion while
|
||||
The ``module_initialize`` function is called during YARA's initialization while
|
||||
its counterpart ``module_finalize`` is called while finalizing YARA. These
|
||||
functions allows you initialize and finalize any global data structure you may
|
||||
need to use in your module.
|
||||
@@ -274,7 +274,7 @@ declare string, integer, or float variables respectively. For example::
|
||||
end_declarations;
|
||||
|
||||
.. note::
|
||||
Floating-point variables requiere YARA version 3.3.0 or later.
|
||||
Floating-point variables require YARA version 3.3.0 or later.
|
||||
|
||||
|
||||
Variable names can't contain characters other than letters, numbers and
|
||||
@@ -322,13 +322,13 @@ Your declarations can be organized in a more structured way::
|
||||
end_declarations;
|
||||
|
||||
In this example we're using ``begin_struct(<structure name>)`` and
|
||||
``end_struct(<structure name>)`` to delimite two structures named
|
||||
``end_struct(<structure name>)`` to delimit two structures named
|
||||
*some_structure* and *another_structure*. Within the structure delimiters you
|
||||
can put any other declarations you want, including another structure
|
||||
declaration. Also notice that members of different structures can have the same
|
||||
name, but members within the same structure must have unique names.
|
||||
|
||||
When refering to these variables from your rules it would be like this::
|
||||
When referring to these variables from your rules it would be like this::
|
||||
|
||||
mymodule.foo
|
||||
mymodule.some_structure.foo
|
||||
@@ -692,7 +692,7 @@ Setting variable's values
|
||||
-------------------------
|
||||
|
||||
The ``module_load`` function is where you assign values to the variables
|
||||
declared in the declarations section, once you've parsed or analized the scanned
|
||||
declared in the declarations section, once you've parsed or analyzed the scanned
|
||||
data and/or any additional module's data. This is done by using the
|
||||
``set_integer`` and ``set_string`` functions:
|
||||
|
||||
@@ -798,7 +798,7 @@ in a dictionary:
|
||||
set_integer(<value>, module, "foo[%s]", "key");
|
||||
set_string(<value>, module, "bar[%s].baz", "another_key");
|
||||
|
||||
If you don't explicitely assign a value to a declared variable, array or
|
||||
If you don't explicitly assign a value to a declared variable, array or
|
||||
dictionary item it will remain in undefined state. That's not a problem at all,
|
||||
and is even useful in many cases. For example, if your module parses files from
|
||||
certain format and it receives one from a different format, you can safely leave
|
||||
@@ -921,7 +921,7 @@ Here you have some examples:
|
||||
|
||||
The C type for integer arguments is ``int64_t``, for float arguments is
|
||||
``double``, for regular expressions is ``RE_CODE``, for NULL-terminated strings
|
||||
is ``char*`` and for string possibly contaning NULL characters is
|
||||
is ``char*`` and for string possibly containing NULL characters is
|
||||
``SIZED_STRING*``. ``SIZED_STRING`` structures have the
|
||||
following attributes:
|
||||
|
||||
@@ -968,7 +968,7 @@ the corresponding ``YR_OBJECT`` first. There are two functions to do that:
|
||||
the top-level ``YR_OBJECT`` corresponding to the module, the same one passed
|
||||
to the ``module_load`` function. The ``parent()`` function returns a pointer to
|
||||
the ``YR_OBJECT`` corresponding to the structure where the function is
|
||||
contained. For example, consider the following code snipet:
|
||||
contained. For example, consider the following code snippet:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
|
||||
@@ -617,7 +617,7 @@ Executable entry point
|
||||
|
||||
Another special variable than can be used on a rule is ``entrypoint``. If file
|
||||
is a Portable Executable (PE) or Executable and Linkable Format (ELF), this
|
||||
variable holds the raw offset of the exectutable’s entry point in case we are
|
||||
variable holds the raw offset of the executable’s entry point in case we are
|
||||
scanning a file. If we are scanning a running process, the entrypoint will hold
|
||||
the virtual address of the main executable’s entry point. A typical use of
|
||||
this variable is to look for some pattern at the entry point to detect packers
|
||||
@@ -1133,7 +1133,7 @@ Including files
|
||||
|
||||
In order to allow you a more flexible organization of your rules files,
|
||||
YARA provides the ``include`` directive. This directive works in a similar way
|
||||
to the *#include* pre-procesor directive in your C programs, which inserts the
|
||||
to the *#include* pre-processor directive in your C programs, which inserts the
|
||||
content of the specified source file into the current file during compilation.
|
||||
The following example will include the content of *other.yar* into the current
|
||||
file::
|
||||
|
||||
@@ -79,7 +79,7 @@ int _yr_ac_queue_push(
|
||||
pushed_node = (QUEUE_NODE*) yr_malloc(sizeof(QUEUE_NODE));
|
||||
|
||||
if (pushed_node == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
pushed_node->previous = queue->tail;
|
||||
pushed_node->next = NULL;
|
||||
@@ -484,7 +484,7 @@ int _yr_ac_find_suitable_transition_table_slot(
|
||||
automaton->m_table, m_bytes_size * 2);
|
||||
|
||||
if (automaton->t_table == NULL || automaton->m_table == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
memset((uint8_t*) automaton->t_table + t_bytes_size, 0, t_bytes_size);
|
||||
memset((uint8_t*) automaton->m_table + m_bytes_size, 0, m_bytes_size);
|
||||
@@ -548,7 +548,7 @@ int _yr_ac_find_suitable_transition_table_slot(
|
||||
// link must be used instead.
|
||||
//
|
||||
// The transition table for state S starts at T[S] and spans the next 257
|
||||
// slots in the array (1 for the failure link and 256 for all the posible
|
||||
// slots in the array (1 for the failure link and 256 for all the possible
|
||||
// transitions). But many of those slots are for invalid transitions, so
|
||||
// the transitions for multiple states can be interleaved as long as they don't
|
||||
// collide. For example, instead of having this transition table with state S1
|
||||
@@ -605,7 +605,7 @@ int _yr_ac_build_transition_table(
|
||||
yr_free(automaton->t_table);
|
||||
yr_free(automaton->m_table);
|
||||
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
memset(automaton->t_table, 0,
|
||||
@@ -775,7 +775,7 @@ int yr_ac_automaton_create(
|
||||
yr_free(new_automaton);
|
||||
yr_free(root_state);
|
||||
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
root_state->depth = 0;
|
||||
@@ -850,7 +850,7 @@ int yr_ac_add_string(
|
||||
next_state = _yr_ac_state_create(state, atom->atom[i]);
|
||||
|
||||
if (next_state == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
state = next_state;
|
||||
|
||||
+10
-10
@@ -195,7 +195,7 @@ int _yr_arena_make_relocatable(
|
||||
reloc = (YR_RELOC*) yr_malloc(sizeof(YR_RELOC));
|
||||
|
||||
if (reloc == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
reloc->offset = (uint32_t) (base_offset + offset);
|
||||
reloc->next = NULL;
|
||||
@@ -241,14 +241,14 @@ int yr_arena_create(
|
||||
new_arena = (YR_ARENA*) yr_malloc(sizeof(YR_ARENA));
|
||||
|
||||
if (new_arena == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
new_page = _yr_arena_new_page(initial_size);
|
||||
|
||||
if (new_page == NULL)
|
||||
{
|
||||
yr_free(new_arena);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
new_arena->page_list_head = new_page;
|
||||
@@ -334,7 +334,7 @@ void* yr_arena_base_address(
|
||||
// yr_arena_next_address
|
||||
//
|
||||
// Given an address and an offset, returns the address where
|
||||
// address + offset resides. The arena is a collection of non-contigous
|
||||
// address + offset resides. The arena is a collection of non-contiguous
|
||||
// regions of memory (pages), if address is pointing at the end of a page,
|
||||
// address + offset could cross the page boundary and point at somewhere
|
||||
// within the next page, this function handles these situations. It works
|
||||
@@ -437,7 +437,7 @@ int yr_arena_coalesce(
|
||||
big_page = _yr_arena_new_page(total_size);
|
||||
|
||||
if (big_page == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
// Copy data from current pages to the big page and adjust relocs.
|
||||
page = arena->page_list_head;
|
||||
@@ -532,7 +532,7 @@ int yr_arena_reserve_memory(
|
||||
if (size > free_space(arena->current_page))
|
||||
{
|
||||
if (arena->flags & ARENA_FLAGS_FIXED_SIZE)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
// Requested space is bigger than current page's empty space,
|
||||
// lets calculate the size for a new page.
|
||||
@@ -551,7 +551,7 @@ int yr_arena_reserve_memory(
|
||||
new_page_size);
|
||||
|
||||
if (new_page_address == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
arena->current_page->address = new_page_address;
|
||||
arena->current_page->size = new_page_size;
|
||||
@@ -561,7 +561,7 @@ int yr_arena_reserve_memory(
|
||||
new_page = _yr_arena_new_page(new_page_size);
|
||||
|
||||
if (new_page == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
new_page->prev = arena->current_page;
|
||||
arena->current_page->next = new_page;
|
||||
@@ -608,7 +608,7 @@ int yr_arena_allocate_memory(
|
||||
// yr_arena_allocate_struct
|
||||
//
|
||||
// Allocates a structure within the arena. This function is similar to
|
||||
// yr_arena_allocate_memory but additionaly receives a variable-length
|
||||
// yr_arena_allocate_memory but additionally receives a variable-length
|
||||
// list of offsets within the structure where pointers reside. This allows
|
||||
// the arena to keep track of pointers that must be adjusted when memory
|
||||
// is relocated. This is an example on how to invoke this function:
|
||||
@@ -861,7 +861,7 @@ int yr_arena_duplicate(
|
||||
if (new_reloc == NULL)
|
||||
{
|
||||
yr_arena_destroy(new_arena);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
new_reloc->offset = reloc->offset;
|
||||
|
||||
+31
-31
@@ -347,7 +347,7 @@ YR_ATOM_LIST_ITEM* _yr_atoms_list_concat(
|
||||
|
||||
int _yr_atoms_choose(
|
||||
ATOM_TREE_NODE* node,
|
||||
YR_ATOM_LIST_ITEM** choosen_atoms,
|
||||
YR_ATOM_LIST_ITEM** chosen_atoms,
|
||||
int* atoms_quality)
|
||||
{
|
||||
ATOM_TREE_NODE* child;
|
||||
@@ -358,7 +358,7 @@ int _yr_atoms_choose(
|
||||
int max_quality = YR_MIN_ATOM_QUALITY;
|
||||
int min_quality = YR_MAX_ATOM_QUALITY;
|
||||
|
||||
*choosen_atoms = NULL;
|
||||
*chosen_atoms = NULL;
|
||||
|
||||
switch (node->type)
|
||||
{
|
||||
@@ -367,7 +367,7 @@ int _yr_atoms_choose(
|
||||
item = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (item == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
for (i = 0; i < node->atom_length; i++)
|
||||
item->atom[i] = node->atom[i];
|
||||
@@ -378,7 +378,7 @@ int _yr_atoms_choose(
|
||||
item->backtrack = 0;
|
||||
item->next = NULL;
|
||||
|
||||
*choosen_atoms = item;
|
||||
*chosen_atoms = item;
|
||||
*atoms_quality = _yr_atoms_quality(node->atom, node->atom_length);
|
||||
break;
|
||||
|
||||
@@ -393,8 +393,8 @@ int _yr_atoms_choose(
|
||||
if (quality > max_quality)
|
||||
{
|
||||
max_quality = quality;
|
||||
yr_atoms_list_destroy(*choosen_atoms);
|
||||
*choosen_atoms = item;
|
||||
yr_atoms_list_destroy(*chosen_atoms);
|
||||
*chosen_atoms = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -424,8 +424,8 @@ int _yr_atoms_choose(
|
||||
while (tail->next != NULL)
|
||||
tail = tail->next;
|
||||
|
||||
tail->next = *choosen_atoms;
|
||||
*choosen_atoms = item;
|
||||
tail->next = *chosen_atoms;
|
||||
*chosen_atoms = item;
|
||||
}
|
||||
|
||||
child = child->next_sibling;
|
||||
@@ -510,13 +510,13 @@ uint8_t* _yr_atoms_case_combinations(
|
||||
sizeof(int)
|
||||
|
||||
//
|
||||
// _yr_atoms_case_insentive
|
||||
// _yr_atoms_case_insensitive
|
||||
//
|
||||
// For a given list of atoms returns another list of atoms
|
||||
// with every case combination.
|
||||
//
|
||||
|
||||
int _yr_atoms_case_insentive(
|
||||
int _yr_atoms_case_insensitive(
|
||||
YR_ATOM_LIST_ITEM* atoms,
|
||||
YR_ATOM_LIST_ITEM** case_insensitive_atoms)
|
||||
{
|
||||
@@ -548,7 +548,7 @@ int _yr_atoms_case_insentive(
|
||||
new_atom = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (new_atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
for (i = 0; i < atom_length; i++)
|
||||
new_atom->atom[i] = atoms_cursor[i];
|
||||
@@ -598,7 +598,7 @@ int _yr_atoms_wide(
|
||||
new_atom = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (new_atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
for (i = 0; i < MAX_ATOM_LENGTH; i++)
|
||||
new_atom->atom[i] = 0;
|
||||
@@ -849,7 +849,7 @@ ATOM_TREE_NODE* _yr_atoms_extract_from_re_node(
|
||||
// yr_atoms_extract_triplets
|
||||
//
|
||||
// On certain cases YARA can not extract long enough atoms from a regexp, but
|
||||
// can infer them. For example, in the hex string { 01 ?? 02 } the only explict
|
||||
// can infer them. For example, in the hex string { 01 ?? 02 } the only explicit
|
||||
// atoms are 01 and 02, and both of them are too short to be efficiently used.
|
||||
// However YARA can use simultaneously atoms 01 00 02, 01 01 02, 01 02 02,
|
||||
// 01 03 02, and so on up to 01 FF 02. Searching for 256 three-bytes atoms is
|
||||
@@ -893,7 +893,7 @@ int yr_atoms_extract_triplets(
|
||||
yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
atom->atom[0] = left_child->left->value;
|
||||
atom->atom[1] = i;
|
||||
@@ -920,7 +920,7 @@ int yr_atoms_extract_triplets(
|
||||
yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
if (left_child->right->mask == 0xF0)
|
||||
shift = 0;
|
||||
@@ -953,7 +953,7 @@ int yr_atoms_extract_triplets(
|
||||
yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
atom->atom[0] = left_grand_child->right->value;
|
||||
atom->atom[1] = i;
|
||||
@@ -981,7 +981,7 @@ int yr_atoms_extract_triplets(
|
||||
yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (atom == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
if (left_child->right->mask == 0xF0)
|
||||
shift = 0;
|
||||
@@ -1021,20 +1021,20 @@ int yr_atoms_extract_from_re(
|
||||
ATOM_TREE* atom_tree = (ATOM_TREE*) yr_malloc(sizeof(ATOM_TREE));
|
||||
ATOM_TREE_NODE* temp;
|
||||
YR_ATOM_LIST_ITEM* wide_atoms;
|
||||
YR_ATOM_LIST_ITEM* case_insentive_atoms;
|
||||
YR_ATOM_LIST_ITEM* case_insensitive_atoms;
|
||||
YR_ATOM_LIST_ITEM* triplet_atoms;
|
||||
|
||||
int min_atom_quality = YR_MIN_ATOM_QUALITY;
|
||||
|
||||
if (atom_tree == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
atom_tree->root_node = _yr_atoms_tree_node_create(ATOM_TREE_OR);
|
||||
|
||||
if (atom_tree->root_node == NULL)
|
||||
{
|
||||
_yr_atoms_tree_destroy(atom_tree);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
atom_tree->current_leaf = NULL;
|
||||
@@ -1045,7 +1045,7 @@ int yr_atoms_extract_from_re(
|
||||
if (atom_tree->root_node == NULL)
|
||||
{
|
||||
_yr_atoms_tree_destroy(atom_tree);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
if (atom_tree->current_leaf != NULL)
|
||||
@@ -1077,7 +1077,7 @@ int yr_atoms_extract_from_re(
|
||||
|
||||
if (min_atom_quality <= 2)
|
||||
{
|
||||
// Choosen atoms contain low quality ones, let's try infering some higher
|
||||
// Chosen atoms contain low quality ones, let's try infering some higher
|
||||
// quality atoms.
|
||||
|
||||
FAIL_ON_ERROR_WITH_CLEANUP(
|
||||
@@ -1123,14 +1123,14 @@ int yr_atoms_extract_from_re(
|
||||
if (flags & STRING_GFLAGS_NO_CASE)
|
||||
{
|
||||
FAIL_ON_ERROR_WITH_CLEANUP(
|
||||
_yr_atoms_case_insentive(*atoms, &case_insentive_atoms),
|
||||
_yr_atoms_case_insensitive(*atoms, &case_insensitive_atoms),
|
||||
{
|
||||
yr_atoms_list_destroy(*atoms);
|
||||
yr_atoms_list_destroy(case_insentive_atoms);
|
||||
yr_atoms_list_destroy(case_insensitive_atoms);
|
||||
*atoms = NULL;
|
||||
});
|
||||
|
||||
*atoms = _yr_atoms_list_concat(*atoms, case_insentive_atoms);
|
||||
*atoms = _yr_atoms_list_concat(*atoms, case_insensitive_atoms);
|
||||
}
|
||||
|
||||
// No atoms has been extracted, let's add a zero-length atom.
|
||||
@@ -1140,7 +1140,7 @@ int yr_atoms_extract_from_re(
|
||||
*atoms = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (*atoms == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
(*atoms)->atom_length = 0;
|
||||
(*atoms)->backtrack = 0;
|
||||
@@ -1166,7 +1166,7 @@ int yr_atoms_extract_from_string(
|
||||
YR_ATOM_LIST_ITEM** atoms)
|
||||
{
|
||||
YR_ATOM_LIST_ITEM* item;
|
||||
YR_ATOM_LIST_ITEM* case_insentive_atoms;
|
||||
YR_ATOM_LIST_ITEM* case_insensitive_atoms;
|
||||
YR_ATOM_LIST_ITEM* wide_atoms;
|
||||
|
||||
int max_quality;
|
||||
@@ -1175,7 +1175,7 @@ int yr_atoms_extract_from_string(
|
||||
item = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM));
|
||||
|
||||
if (item == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
item->forward_code = NULL;
|
||||
item->backward_code = NULL;
|
||||
@@ -1232,14 +1232,14 @@ int yr_atoms_extract_from_string(
|
||||
if (flags & STRING_GFLAGS_NO_CASE)
|
||||
{
|
||||
FAIL_ON_ERROR_WITH_CLEANUP(
|
||||
_yr_atoms_case_insentive(*atoms, &case_insentive_atoms),
|
||||
_yr_atoms_case_insensitive(*atoms, &case_insensitive_atoms),
|
||||
{
|
||||
yr_atoms_list_destroy(*atoms);
|
||||
yr_atoms_list_destroy(case_insentive_atoms);
|
||||
yr_atoms_list_destroy(case_insensitive_atoms);
|
||||
*atoms = NULL;
|
||||
});
|
||||
|
||||
*atoms = _yr_atoms_list_concat(*atoms, case_insentive_atoms);
|
||||
*atoms = _yr_atoms_list_concat(*atoms, case_insensitive_atoms);
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
+4
-4
@@ -51,7 +51,7 @@ YR_API int yr_compiler_create(
|
||||
new_compiler = (YR_COMPILER*) yr_calloc(1, sizeof(YR_COMPILER));
|
||||
|
||||
if (new_compiler == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
new_compiler->errors = 0;
|
||||
new_compiler->callback = NULL;
|
||||
@@ -234,7 +234,7 @@ int _yr_compiler_push_file_name(
|
||||
str = yr_strdup(file_name);
|
||||
|
||||
if (str == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
compiler->file_name_stack[compiler->file_name_stack_ptr] = str;
|
||||
compiler->file_name_stack_ptr++;
|
||||
@@ -607,7 +607,7 @@ YR_API int yr_compiler_get_rules(
|
||||
yara_rules = (YR_RULES*) yr_malloc(sizeof(YR_RULES));
|
||||
|
||||
if (yara_rules == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
FAIL_ON_ERROR_WITH_CLEANUP(
|
||||
yr_arena_duplicate(compiler->compiled_rules_arena, &yara_rules->arena),
|
||||
@@ -817,7 +817,7 @@ YR_API char* yr_compiler_get_error_message(
|
||||
{
|
||||
switch(compiler->last_error)
|
||||
{
|
||||
case ERROR_INSUFICIENT_MEMORY:
|
||||
case ERROR_INSUFFICIENT_MEMORY:
|
||||
snprintf(buffer, buffer_size, "not enough memory");
|
||||
break;
|
||||
case ERROR_DUPLICATED_IDENTIFIER:
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ int yr_execute_code(
|
||||
stack = (YR_VALUE*) yr_malloc(stack_size * sizeof(YR_VALUE));
|
||||
|
||||
if (stack == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
while(!stop)
|
||||
{
|
||||
|
||||
+3
-3
@@ -2796,7 +2796,7 @@ yyreduce:
|
||||
yyscanner, OP_INCR_M, mem_offset + 2, NULL, NULL);
|
||||
|
||||
// If next string is not undefined, go back to the
|
||||
// begining of the loop.
|
||||
// beginning of the loop.
|
||||
yr_parser_emit_with_arg_reloc(
|
||||
yyscanner,
|
||||
OP_JNUNDEF,
|
||||
@@ -2866,7 +2866,7 @@ yyreduce:
|
||||
fixup = (YR_FIXUP*) yr_malloc(sizeof(YR_FIXUP));
|
||||
|
||||
if (fixup == NULL)
|
||||
compiler->last_error = ERROR_INSUFICIENT_MEMORY;
|
||||
compiler->last_error = ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
|
||||
|
||||
@@ -2935,7 +2935,7 @@ yyreduce:
|
||||
fixup = (YR_FIXUP*) yr_malloc(sizeof(YR_FIXUP));
|
||||
|
||||
if (fixup == NULL)
|
||||
compiler->last_error = ERROR_INSUFICIENT_MEMORY;
|
||||
compiler->last_error = ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
|
||||
|
||||
|
||||
+3
-3
@@ -1210,7 +1210,7 @@ expression
|
||||
yyscanner, OP_INCR_M, mem_offset + 2, NULL, NULL);
|
||||
|
||||
// If next string is not undefined, go back to the
|
||||
// begining of the loop.
|
||||
// beginning of the loop.
|
||||
yr_parser_emit_with_arg_reloc(
|
||||
yyscanner,
|
||||
OP_JNUNDEF,
|
||||
@@ -1268,7 +1268,7 @@ expression
|
||||
fixup = (YR_FIXUP*) yr_malloc(sizeof(YR_FIXUP));
|
||||
|
||||
if (fixup == NULL)
|
||||
compiler->last_error = ERROR_INSUFICIENT_MEMORY;
|
||||
compiler->last_error = ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
|
||||
|
||||
@@ -1329,7 +1329,7 @@ expression
|
||||
fixup = (YR_FIXUP*) yr_malloc(sizeof(YR_FIXUP));
|
||||
|
||||
if (fixup == NULL)
|
||||
compiler->last_error = ERROR_INSUFICIENT_MEMORY;
|
||||
compiler->last_error = ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
|
||||
|
||||
|
||||
+4
-4
@@ -112,7 +112,7 @@ YR_API int yr_hash_table_create(
|
||||
sizeof(YR_HASH_TABLE) + size * sizeof(YR_HASH_TABLE_ENTRY*));
|
||||
|
||||
if (new_table == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
new_table->size = size;
|
||||
|
||||
@@ -221,14 +221,14 @@ YR_API int yr_hash_table_add_raw_key(
|
||||
entry = (YR_HASH_TABLE_ENTRY*) yr_malloc(sizeof(YR_HASH_TABLE_ENTRY));
|
||||
|
||||
if (entry == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
entry->key = yr_malloc(key_length);
|
||||
|
||||
if (entry->key == NULL)
|
||||
{
|
||||
yr_free(entry);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
if (ns != NULL)
|
||||
@@ -240,7 +240,7 @@ YR_API int yr_hash_table_add_raw_key(
|
||||
yr_free(entry->key);
|
||||
yr_free(entry);
|
||||
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
+15
-15
@@ -1345,7 +1345,7 @@ yyreduce:
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1351 "hex_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1407,7 +1407,7 @@ yyreduce:
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1413 "hex_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1428,7 +1428,7 @@ yyreduce:
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1434 "hex_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1505,11 +1505,11 @@ yyreduce:
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = (int) (yyvsp[-1].integer);
|
||||
(yyval.re_node)->end = (int) (yyvsp[-1].integer);
|
||||
@@ -1547,11 +1547,11 @@ yyreduce:
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = (int) (yyvsp[-3].integer);
|
||||
(yyval.re_node)->end = (int) (yyvsp[-1].integer);
|
||||
@@ -1579,11 +1579,11 @@ yyreduce:
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = (int) (yyvsp[-2].integer);
|
||||
(yyval.re_node)->end = INT_MAX;
|
||||
@@ -1605,11 +1605,11 @@ yyreduce:
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = 0;
|
||||
(yyval.re_node)->end = INT_MAX;
|
||||
@@ -1635,7 +1635,7 @@ yyreduce:
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1641 "hex_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1645,7 +1645,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->value = (int) (yyvsp[0].integer);
|
||||
}
|
||||
@@ -1661,13 +1661,13 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_MASKED_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->value = (yyvsp[0].integer) & 0xFF;
|
||||
(yyval.re_node)->mask = mask;
|
||||
|
||||
+15
-15
@@ -122,7 +122,7 @@ tokens
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
DESTROY_NODE_IF($$ == NULL, $2);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| token token_sequence token
|
||||
{
|
||||
@@ -180,7 +180,7 @@ tokens
|
||||
DESTROY_NODE_IF($$ == NULL, $2);
|
||||
DESTROY_NODE_IF($$ == NULL, $3);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -197,7 +197,7 @@ token_sequence
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
DESTROY_NODE_IF($$ == NULL, $2);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -262,11 +262,11 @@ range
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = (int) $2;
|
||||
$$->end = (int) $2;
|
||||
@@ -300,11 +300,11 @@ range
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = (int) $2;
|
||||
$$->end = (int) $4;
|
||||
@@ -328,11 +328,11 @@ range
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = (int) $2;
|
||||
$$->end = INT_MAX;
|
||||
@@ -350,11 +350,11 @@ range
|
||||
|
||||
re_any = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(re_any == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, re_any, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = 0;
|
||||
$$->end = INT_MAX;
|
||||
@@ -376,7 +376,7 @@ alternatives
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
DESTROY_NODE_IF($$ == NULL, $3);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -385,7 +385,7 @@ byte
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->value = (int) $1;
|
||||
}
|
||||
@@ -397,13 +397,13 @@ byte
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_MASKED_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->value = $1 & 0xFF;
|
||||
$$->mask = mask;
|
||||
|
||||
+1
-1
@@ -2227,7 +2227,7 @@ int yr_parse_hex_string(
|
||||
|
||||
// The RE_FLAGS_FAST_HEX_REGEXP flag indicates a regular expression derived
|
||||
// from a hex string that can be matched by faster algorithm. These regular
|
||||
// expressions come from hex strings not contaning alternatives, like in:
|
||||
// expressions come from hex strings not containing alternatives, like in:
|
||||
// { ( 01 02 | 03 04) 05 06 }.
|
||||
//
|
||||
// This flag is unset later during parsing if alternatives are used.
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ int yr_parse_hex_string(
|
||||
|
||||
// The RE_FLAGS_FAST_HEX_REGEXP flag indicates a regular expression derived
|
||||
// from a hex string that can be matched by faster algorithm. These regular
|
||||
// expressions come from hex strings not contaning alternatives, like in:
|
||||
// expressions come from hex strings not containing alternatives, like in:
|
||||
// { ( 01 02 | 03 04) 05 06 }.
|
||||
//
|
||||
// This flag is unset later during parsing if alternatives are used.
|
||||
|
||||
@@ -52,7 +52,7 @@ typedef uint64_t elf64_xword_t;
|
||||
|
||||
#define ELF_ET_NONE 0x0000 // no type
|
||||
#define ELF_ET_REL 0x0001 // relocatable
|
||||
#define ELF_ET_EXEC 0x0002 // executeable
|
||||
#define ELF_ET_EXEC 0x0002 // executable
|
||||
#define ELF_ET_DYN 0x0003 // Shared-Object-File
|
||||
#define ELF_ET_CORE 0x0004 // Corefile
|
||||
#define ELF_ET_LOPROC 0xFF00 // Processor-specific
|
||||
|
||||
@@ -40,7 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define ERROR_SUCCESS 0
|
||||
#endif
|
||||
|
||||
#define ERROR_INSUFICIENT_MEMORY 1
|
||||
#define ERROR_INSUFFICIENT_MEMORY 1
|
||||
#define ERROR_COULD_NOT_ATTACH_TO_PROCESS 2
|
||||
#define ERROR_COULD_NOT_OPEN_FILE 3
|
||||
#define ERROR_COULD_NOT_MAP_FILE 4
|
||||
|
||||
@@ -39,7 +39,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Microsoft Visual Studio C++ before Visual Studio 2010 or earlier versions of the Borland C++ Builder
|
||||
* do not support the (u)int#_t type definitions but have __int# defintions instead
|
||||
* do not support the (u)int#_t type definitions but have __int# definitions instead
|
||||
*/
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
|
||||
@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "utils.h"
|
||||
|
||||
// MAX_THREADS is the number of threads that can use a YR_RULES
|
||||
// object simultaneosly.
|
||||
// object simultaneously.
|
||||
|
||||
#define MAX_THREADS 32
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ int yr_parser_emit_pushes_for_strings(
|
||||
int yr_parser_reduce_external(
|
||||
yyscan_t yyscanner,
|
||||
const char* identifier,
|
||||
uint8_t intruction);
|
||||
uint8_t instruction);
|
||||
|
||||
|
||||
int yr_parser_reduce_import(
|
||||
|
||||
@@ -129,10 +129,10 @@ typedef struct _IMAGE_FILE_HEADER {
|
||||
|
||||
|
||||
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
||||
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved external references).
|
||||
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line numbers stripped from file.
|
||||
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
||||
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 // Agressively trim working set
|
||||
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010 // Aggressively trim working set
|
||||
#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 // App can handle >2gb addresses
|
||||
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
||||
#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ YR_API void yr_finalize_thread(void)
|
||||
// yr_finalize
|
||||
//
|
||||
// Should be called by main thread before exiting. Main thread doesn't
|
||||
// need to explicitely call yr_finalize_thread because yr_finalize already
|
||||
// need to explicitly call yr_finalize_thread because yr_finalize already
|
||||
// calls it.
|
||||
//
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ void dotnet_parse_tilde_2(
|
||||
// all that is valid then you can take the Value from the CustomAttribute
|
||||
// table to find out the index into the Blob stream and parse that.
|
||||
//
|
||||
// Luckily we can abuse the fact that the order of the tables is guranteed
|
||||
// Luckily we can abuse the fact that the order of the tables is guaranteed
|
||||
// consistent (though some may not exist, but if they do exist they must exist
|
||||
// in a certain order). The order is defined by their position in the Valid
|
||||
// member of the tilde_header structure. By the time we are parsing the
|
||||
@@ -1235,7 +1235,7 @@ int module_load(
|
||||
PE* pe = (PE*) yr_malloc(sizeof(PE));
|
||||
|
||||
if (pe == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
pe->data = block_data;
|
||||
pe->data_size = block->size;
|
||||
|
||||
@@ -102,7 +102,7 @@ int add_to_cache(
|
||||
key.length = length;
|
||||
|
||||
if (copy == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
return yr_hash_table_add_raw_key(
|
||||
hash_table,
|
||||
@@ -241,7 +241,7 @@ define_function(data_md5)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
|
||||
@@ -325,7 +325,7 @@ define_function(data_sha1)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
|
||||
@@ -408,7 +408,7 @@ define_function(data_sha256)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
|
||||
@@ -477,7 +477,7 @@ define_function(data_checksum32)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ int module_load(
|
||||
}
|
||||
else
|
||||
{
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ define_function(data_entropy)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
|
||||
@@ -234,7 +234,7 @@ define_function(data_deviation)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
return_float(UNDEFINED);
|
||||
@@ -310,7 +310,7 @@ define_function(data_mean)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
return_float(UNDEFINED);
|
||||
@@ -384,7 +384,7 @@ define_function(data_serial_correlation)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
return_float(UNDEFINED);
|
||||
@@ -516,7 +516,7 @@ define_function(data_monte_carlo_pi)
|
||||
{
|
||||
// If offset is not within current block and we already
|
||||
// past the first block then the we are trying to compute
|
||||
// the checksum over a range of non contiguos blocks. As
|
||||
// the checksum over a range of non contiguous blocks. As
|
||||
// range contains gaps of undefined data the checksum is
|
||||
// undefined.
|
||||
return_float(UNDEFINED);
|
||||
|
||||
@@ -251,7 +251,7 @@ void pe_parse_rich_signature(
|
||||
|
||||
// Return a pointer to the resource directory string or NULL.
|
||||
// The callback function will parse this and call set_sized_string().
|
||||
// The pointer is guranteed to have enough space to contain the entire string.
|
||||
// The pointer is guaranteed to have enough space to contain the entire string.
|
||||
|
||||
uint8_t* parse_resource_name(
|
||||
PE* pe,
|
||||
@@ -1517,7 +1517,7 @@ define_function(imphash)
|
||||
dll_name = (char *) yr_malloc(dll_name_len + 1);
|
||||
|
||||
if (!dll_name)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
strlcpy(dll_name, dll->name, dll_name_len + 1);
|
||||
|
||||
@@ -2396,7 +2396,7 @@ int module_load(
|
||||
pe = (PE*) yr_malloc(sizeof(PE));
|
||||
|
||||
if (pe == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
pe->data = block_data;
|
||||
pe->data_size = block->size;
|
||||
|
||||
+8
-8
@@ -93,7 +93,7 @@ int yr_object_create(
|
||||
obj = (YR_OBJECT*) yr_malloc(object_size);
|
||||
|
||||
if (obj == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
obj->type = type;
|
||||
obj->identifier = yr_strdup(identifier);
|
||||
@@ -138,7 +138,7 @@ int yr_object_create(
|
||||
if (obj->identifier == NULL)
|
||||
{
|
||||
yr_free(obj);
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
}
|
||||
|
||||
if (parent != NULL)
|
||||
@@ -678,7 +678,7 @@ int yr_object_structure_set_member(
|
||||
sm = (YR_STRUCTURE_MEMBER*) yr_malloc(sizeof(YR_STRUCTURE_MEMBER));
|
||||
|
||||
if (sm == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
member->parent = object;
|
||||
sm->object = member;
|
||||
@@ -743,7 +743,7 @@ int yr_object_array_set_item(
|
||||
sizeof(YR_ARRAY_ITEMS) + count * sizeof(YR_OBJECT*));
|
||||
|
||||
if (array->items == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
memset(array->items->objects, 0, count * sizeof(YR_OBJECT*));
|
||||
|
||||
@@ -757,7 +757,7 @@ int yr_object_array_set_item(
|
||||
sizeof(YR_ARRAY_ITEMS) + count * sizeof(YR_OBJECT*));
|
||||
|
||||
if (array->items == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
for (i = array->items->count; i < count; i++)
|
||||
array->items->objects[i] = NULL;
|
||||
@@ -829,7 +829,7 @@ int yr_object_dict_set_item(
|
||||
sizeof(YR_DICTIONARY_ITEMS) + count * sizeof(dict->items->objects[0]));
|
||||
|
||||
if (dict->items == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
memset(dict->items->objects, 0, count * sizeof(dict->items->objects[0]));
|
||||
|
||||
@@ -844,7 +844,7 @@ int yr_object_dict_set_item(
|
||||
sizeof(YR_DICTIONARY_ITEMS) + count * sizeof(dict->items->objects[0]));
|
||||
|
||||
if (dict->items == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
for (i = dict->items->used; i < count; i++)
|
||||
{
|
||||
@@ -1069,7 +1069,7 @@ int yr_object_set_string(
|
||||
string_obj->value = (SIZED_STRING*) yr_malloc(len + sizeof(SIZED_STRING));
|
||||
|
||||
if (string_obj->value == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
string_obj->value->length = (uint32_t) len;
|
||||
string_obj->value->flags = 0;
|
||||
|
||||
+1
-1
@@ -483,7 +483,7 @@ int yr_process_open_iterator(
|
||||
yr_malloc(sizeof(YR_PROC_ITERATOR_CTX));
|
||||
|
||||
if (context == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
iterator->context = context;
|
||||
iterator->first = _yr_get_first_block;
|
||||
|
||||
+7
-7
@@ -57,7 +57,7 @@ order to avoid confusion with operating system threads.
|
||||
// over 255 without changing RE_SPLIT_ID_TYPE.
|
||||
#define RE_MAX_SPLIT_ID 128
|
||||
|
||||
// Maxium stack size for regexp evaluation
|
||||
// Maximum stack size for regexp evaluation
|
||||
#define RE_MAX_STACK 1024
|
||||
|
||||
// Maximum code size for a compiled regexp
|
||||
@@ -66,7 +66,7 @@ order to avoid confusion with operating system threads.
|
||||
// Maximum input size scanned by yr_re_exec
|
||||
#define RE_SCAN_LIMIT 4096
|
||||
|
||||
// Maxium number of fibers
|
||||
// Maximum number of fibers
|
||||
#define RE_MAX_FIBERS 1024
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ int yr_re_create(
|
||||
*re = (RE*) yr_malloc(sizeof(RE));
|
||||
|
||||
if (*re == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
(*re)->flags = 0;
|
||||
(*re)->root_node = NULL;
|
||||
@@ -1250,7 +1250,7 @@ int _yr_re_alloc_storage(
|
||||
*storage = (RE_THREAD_STORAGE*) yr_malloc(sizeof(RE_THREAD_STORAGE));
|
||||
|
||||
if (*storage == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
(*storage)->fiber_pool.fiber_count = 0;
|
||||
(*storage)->fiber_pool.fibers.head = NULL;
|
||||
@@ -1286,7 +1286,7 @@ int _yr_re_fiber_create(
|
||||
fiber = (RE_FIBER*) yr_malloc(sizeof(RE_FIBER));
|
||||
|
||||
if (fiber == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
fiber_pool->fiber_count++;
|
||||
}
|
||||
@@ -1704,7 +1704,7 @@ int yr_re_exec(
|
||||
}
|
||||
|
||||
#define fail_if_error(e) switch (e) { \
|
||||
case ERROR_INSUFICIENT_MEMORY: \
|
||||
case ERROR_INSUFFICIENT_MEMORY: \
|
||||
return -2; \
|
||||
case ERROR_TOO_MANY_RE_FIBERS: \
|
||||
return -4; \
|
||||
@@ -1917,7 +1917,7 @@ int yr_re_exec(
|
||||
|
||||
switch(cb_result)
|
||||
{
|
||||
case ERROR_INSUFICIENT_MEMORY:
|
||||
case ERROR_INSUFFICIENT_MEMORY:
|
||||
return -2;
|
||||
case ERROR_TOO_MANY_MATCHES:
|
||||
return -3;
|
||||
|
||||
+25
-25
@@ -1352,7 +1352,7 @@ yyreduce:
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1358 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1363,11 +1363,11 @@ yyreduce:
|
||||
RE_NODE* node = yr_re_node_create(RE_NODE_EMPTY, NULL, NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
ERROR_IF(node == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(node == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_ALT, (yyvsp[-1].re_node), node);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1373 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1387,7 +1387,7 @@ yyreduce:
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[0].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1393 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1401,7 +1401,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_STAR, (yyvsp[-1].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1407 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1415,7 +1415,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_STAR, (yyvsp[-2].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->greedy = FALSE;
|
||||
}
|
||||
@@ -1431,7 +1431,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_PLUS, (yyvsp[-1].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1437 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1445,7 +1445,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_PLUS, (yyvsp[-2].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->greedy = FALSE;
|
||||
}
|
||||
@@ -1461,7 +1461,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, (yyvsp[-1].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = 0;
|
||||
(yyval.re_node)->end = 1;
|
||||
@@ -1478,7 +1478,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, (yyvsp[-2].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = 0;
|
||||
(yyval.re_node)->end = 1;
|
||||
@@ -1496,7 +1496,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, (yyvsp[-1].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-1].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = (yyvsp[0].range) & 0xFFFF;;
|
||||
(yyval.re_node)->end = (yyvsp[0].range) >> 16;;
|
||||
@@ -1513,7 +1513,7 @@ yyreduce:
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_RANGE, (yyvsp[-2].re_node), NULL);
|
||||
|
||||
DESTROY_NODE_IF((yyval.re_node) == NULL, (yyvsp[-2].re_node));
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->start = (yyvsp[-1].range) & 0xFFFF;;
|
||||
(yyval.re_node)->end = (yyvsp[-1].range) >> 16;;
|
||||
@@ -1535,7 +1535,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_WORD_BOUNDARY, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1541 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1545,7 +1545,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_NON_WORD_BOUNDARY, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1551 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1555,7 +1555,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_ANCHOR_START, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1561 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1565,7 +1565,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_ANCHOR_END, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1571 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1583,7 +1583,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1589 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1593,7 +1593,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->value = (yyvsp[0].integer);
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_WORD_CHAR, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1611 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1615,7 +1615,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_NON_WORD_CHAR, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1621 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1625,7 +1625,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_SPACE, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1631 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1635,7 +1635,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_NON_SPACE, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1641 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1645,7 +1645,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_DIGIT, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1651 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1655,7 +1655,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_NON_DIGIT, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
#line 1661 "re_grammar.c" /* yacc.c:1646 */
|
||||
break;
|
||||
@@ -1665,7 +1665,7 @@ yyreduce:
|
||||
{
|
||||
(yyval.re_node) = yr_re_node_create(RE_NODE_CLASS, NULL, NULL);
|
||||
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF((yyval.re_node) == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
(yyval.re_node)->class_vector = (yyvsp[0].class_vector);
|
||||
}
|
||||
|
||||
+25
-25
@@ -118,18 +118,18 @@ alternative
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
DESTROY_NODE_IF($$ == NULL, $3);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| alternative '|'
|
||||
{
|
||||
RE_NODE* node = yr_re_node_create(RE_NODE_EMPTY, NULL, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF(node == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF(node == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$ = yr_re_node_create(RE_NODE_ALT, $1, node);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -144,7 +144,7 @@ concatenation
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
DESTROY_NODE_IF($$ == NULL, $2);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -157,7 +157,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_STAR, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| single '*' '?'
|
||||
{
|
||||
@@ -167,7 +167,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_STAR, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->greedy = FALSE;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_PLUS, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| single '+' '?'
|
||||
{
|
||||
@@ -189,7 +189,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_PLUS, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->greedy = FALSE;
|
||||
}
|
||||
@@ -201,7 +201,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = 0;
|
||||
$$->end = 1;
|
||||
@@ -214,7 +214,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = 0;
|
||||
$$->end = 1;
|
||||
@@ -228,7 +228,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = $2 & 0xFFFF;;
|
||||
$$->end = $2 >> 16;;
|
||||
@@ -241,7 +241,7 @@ repeat
|
||||
$$ = yr_re_node_create(RE_NODE_RANGE, $1, NULL);
|
||||
|
||||
DESTROY_NODE_IF($$ == NULL, $1);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->start = $2 & 0xFFFF;;
|
||||
$$->end = $2 >> 16;;
|
||||
@@ -255,25 +255,25 @@ repeat
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_WORD_BOUNDARY, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _NON_WORD_BOUNDARY_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_NON_WORD_BOUNDARY, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| '^'
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_ANCHOR_START, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| '$'
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_ANCHOR_END, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
;
|
||||
|
||||
@@ -286,13 +286,13 @@ single
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_ANY, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _CHAR_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_LITERAL, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->value = $1;
|
||||
}
|
||||
@@ -300,43 +300,43 @@ single
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_WORD_CHAR, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _NON_WORD_CHAR_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_NON_WORD_CHAR, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _SPACE_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_SPACE, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _NON_SPACE_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_NON_SPACE, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _DIGIT_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_DIGIT, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _NON_DIGIT_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_NON_DIGIT, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
}
|
||||
| _CLASS_
|
||||
{
|
||||
$$ = yr_re_node_create(RE_NODE_CLASS, NULL, NULL);
|
||||
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFICIENT_MEMORY);
|
||||
ERROR_IF($$ == NULL, ERROR_INSUFFICIENT_MEMORY);
|
||||
|
||||
$$->class_vector = $1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1255,7 +1255,7 @@ YY_RULE_SETUP
|
||||
if (i == 6)
|
||||
continue;
|
||||
|
||||
// digits 8 and 9 are the lowest two bits in the senventh byte of the
|
||||
// digits 8 and 9 are the lowest two bits in the seventh byte of the
|
||||
// vector, let those bits alone.
|
||||
if (i == 7)
|
||||
LEX_ENV->class_vector[i] |= 0xFC;
|
||||
|
||||
+1
-1
@@ -390,7 +390,7 @@ hex_digit [0-9a-fA-F]
|
||||
if (i == 6)
|
||||
continue;
|
||||
|
||||
// digits 8 and 9 are the lowest two bits in the senventh byte of the
|
||||
// digits 8 and 9 are the lowest two bits in the seventh byte of the
|
||||
// vector, let those bits alone.
|
||||
if (i == 7)
|
||||
LEX_ENV->class_vector[i] |= 0xFC;
|
||||
|
||||
+2
-2
@@ -159,7 +159,7 @@ YR_API int yr_rules_define_string_variable(
|
||||
external->value.s = yr_strdup(value);
|
||||
|
||||
if (external->value.s == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
else
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ YR_API int yr_rules_load_stream(
|
||||
YR_RULES* new_rules = (YR_RULES*) yr_malloc(sizeof(YR_RULES));
|
||||
|
||||
if (new_rules == NULL)
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
FAIL_ON_ERROR_WITH_CLEANUP(
|
||||
yr_arena_load_stream(stream, &new_rules->arena),
|
||||
|
||||
+4
-4
@@ -227,7 +227,7 @@ int _yr_scan_fast_hex_re_exec(
|
||||
|
||||
switch(cb_result)
|
||||
{
|
||||
case ERROR_INSUFICIENT_MEMORY:
|
||||
case ERROR_INSUFFICIENT_MEMORY:
|
||||
return -2;
|
||||
case ERROR_TOO_MANY_MATCHES:
|
||||
return -3;
|
||||
@@ -320,7 +320,7 @@ int _yr_scan_fast_hex_re_exec(
|
||||
|
||||
case RE_OPCODE_PUSH:
|
||||
|
||||
// A PUSH operation indicates the begining of a code sequence
|
||||
// A PUSH operation indicates the beginning of a code sequence
|
||||
// generated for a jump. (example: { 01 02 [n-m] 03 04 }) The
|
||||
// code sequence looks like this:
|
||||
//
|
||||
@@ -815,7 +815,7 @@ int _yr_scan_verify_re_match(
|
||||
case -1:
|
||||
return ERROR_SUCCESS;
|
||||
case -2:
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
case -3:
|
||||
return ERROR_TOO_MANY_MATCHES;
|
||||
case -4:
|
||||
@@ -848,7 +848,7 @@ int _yr_scan_verify_re_match(
|
||||
switch(backward_matches)
|
||||
{
|
||||
case -2:
|
||||
return ERROR_INSUFICIENT_MEMORY;
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
case -3:
|
||||
return ERROR_TOO_MANY_MATCHES;
|
||||
case -4:
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# We've rewritten the inconsistency check code (from avahi), to work
|
||||
# more broadly. In particular, it no longer assumes ld accepts -zdefs.
|
||||
# This caused a restructing of the code, but the functionality has only
|
||||
# This caused a restructuring of the code, but the functionality has only
|
||||
# changed a little.
|
||||
|
||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||
|
||||
@@ -499,7 +499,7 @@ void print_scanner_error(
|
||||
case ERROR_COULD_NOT_ATTACH_TO_PROCESS:
|
||||
fprintf(stderr, "can not attach to process (try running as root)\n");
|
||||
break;
|
||||
case ERROR_INSUFICIENT_MEMORY:
|
||||
case ERROR_INSUFFICIENT_MEMORY:
|
||||
fprintf(stderr, "not enough memory\n");
|
||||
break;
|
||||
case ERROR_SCAN_TIMEOUT:
|
||||
|
||||
@@ -7,7 +7,7 @@ language.
|
||||
[OPTION]... RULES_FILE FILE | DIR | PID
|
||||
.SH DESCRIPTION
|
||||
yara scans the given FILE, all files contained in directory DIR, or the process
|
||||
indentified by PID looking for matches of patterns and rules provided in a
|
||||
identified by PID looking for matches of patterns and rules provided in a
|
||||
special purpose-language. The rules are read from RULES_FILE.
|
||||
.PP
|
||||
The options to
|
||||
|
||||
Reference in New Issue
Block a user