[Forensics-changes] [yara] 175/192: Fix warnings and minor code re-styling
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:32:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.6.0
in repository yara.
commit c3a6f1ef45e87828e02c73203a8745041594ae0e
Author: plusvic <plusvic at gmail.com>
Date: Mon May 15 15:10:51 2017 +0200
Fix warnings and minor code re-styling
---
libyara/arena.c | 3 ++-
libyara/exec.c | 2 +-
libyara/object.c | 2 ++
libyara/re.c | 8 ++++----
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/libyara/arena.c b/libyara/arena.c
index f53775d..fdfd732 100644
--- a/libyara/arena.c
+++ b/libyara/arena.c
@@ -146,6 +146,7 @@ YR_ARENA_PAGE* _yr_arena_page_for_address(
if ((uint8_t*) address >= page->address &&
(uint8_t*) address < page->address + page->used)
return page;
+
page = page->next;
}
@@ -449,7 +450,7 @@ int yr_arena_coalesce(
reloc = page->reloc_list_head;
- while(reloc != NULL)
+ while (reloc != NULL)
{
reloc->offset += (uint32_t) big_page->used;
reloc = reloc->next;
diff --git a/libyara/exec.c b/libyara/exec.c
index e379229..1b63d51 100644
--- a/libyara/exec.c
+++ b/libyara/exec.c
@@ -445,7 +445,7 @@ int yr_execute_code(
start = clock();
#endif
- assert(sp == 0);
+ assert(sp == 0); // at this point the stack should be empty.
break;
case OP_OBJ_LOAD:
diff --git a/libyara/object.c b/libyara/object.c
index 6cb1ff9..b130278 100644
--- a/libyara/object.c
+++ b/libyara/object.c
@@ -577,10 +577,12 @@ int yr_object_copy(
break;
case OBJECT_TYPE_STRING:
+
if (object->value.ss != NULL)
copy->value.ss = sized_string_dup(object->value.ss);
else
copy->value.ss = NULL;
+
break;
case OBJECT_TYPE_FUNCTION:
diff --git a/libyara/re.c b/libyara/re.c
index 9a12215..5c55382 100644
--- a/libyara/re.c
+++ b/libyara/re.c
@@ -146,7 +146,7 @@ YR_THREAD_STORAGE_KEY thread_storage_key = 0;
int _yr_re_is_word_char(
uint8_t* input,
- int character_size)
+ uint8_t character_size)
{
int result = ((isalnum(*input) || (*input) == '_'));
@@ -968,7 +968,7 @@ int _yr_re_emit(
FAIL_ON_ERROR(_yr_emit_split(
emit_context,
re_node->greedy ? RE_OPCODE_SPLIT_B : RE_OPCODE_SPLIT_A,
- -branch_size,
+ -((int16_t) branch_size),
NULL,
&split_offset_addr,
&split_size));
@@ -1009,7 +1009,7 @@ int _yr_re_emit(
FAIL_ON_ERROR(_yr_emit_inst_arg_int16(
emit_context,
RE_OPCODE_JUMP,
- -(branch_size + split_size),
+ -((uint16_t)(branch_size + split_size)),
NULL,
&jmp_offset_addr,
&jmp_size));
@@ -1873,6 +1873,7 @@ int yr_re_exec(
uint8_t* input;
uint8_t mask;
uint8_t value;
+ uint8_t character_size;
RE_FIBER_LIST fibers;
RE_THREAD_STORAGE* storage;
@@ -1882,7 +1883,6 @@ int yr_re_exec(
int bytes_matched;
int max_bytes_matched;
int match;
- int character_size;
int input_incr;
int kill;
int action;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list