mirror of
https://github.com/VirusTotal/yara.git
synced 2026-10-12 02:10:00 +00:00
Fix some warnings.
This commit is contained in:
+2
-2
@@ -223,7 +223,7 @@ static int _yr_arena_allocate_memory(
|
||||
// ERROR_INSUFFICIENT_MEMORY
|
||||
//
|
||||
int yr_arena_create(
|
||||
int number_of_buffers,
|
||||
uint32_t num_buffers,
|
||||
size_t initial_buffer_size,
|
||||
YR_ARENA** arena)
|
||||
{
|
||||
@@ -233,7 +233,7 @@ int yr_arena_create(
|
||||
return ERROR_INSUFFICIENT_MEMORY;
|
||||
|
||||
new_arena->xrefs = 1;
|
||||
new_arena->num_buffers = number_of_buffers;
|
||||
new_arena->num_buffers = num_buffers;
|
||||
new_arena->initial_buffer_size = initial_buffer_size;
|
||||
|
||||
*arena = new_arena;
|
||||
|
||||
+1
-1
@@ -475,7 +475,7 @@ int yr_execute_code(YR_SCAN_CONTEXT* context)
|
||||
pop(r1);
|
||||
|
||||
r3.p = yr_notebook_alloc(
|
||||
it_notebook, sizeof(YR_ITERATOR) + sizeof(uint64_t) * r1.i);
|
||||
it_notebook, sizeof(YR_ITERATOR) + sizeof(uint64_t) * (size_t) r1.i);
|
||||
|
||||
if (r3.p == NULL)
|
||||
{
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ YR_API int yr_filemap_map_fd(
|
||||
return ERROR_COULD_NOT_OPEN_FILE;
|
||||
}
|
||||
|
||||
if (offset > file_size)
|
||||
if (offset > (off_t) file_size)
|
||||
return ERROR_COULD_NOT_MAP_FILE;
|
||||
|
||||
if (size == 0)
|
||||
|
||||
+4
-4
@@ -2312,8 +2312,8 @@ yyreduce:
|
||||
fail_if_error(result);
|
||||
|
||||
(yyval.modifier).flags = STRING_FLAGS_XOR;
|
||||
(yyval.modifier).xor_min = (yyvsp[-1].integer);
|
||||
(yyval.modifier).xor_max = (yyvsp[-1].integer);
|
||||
(yyval.modifier).xor_min = (uint8_t) (yyvsp[-1].integer);
|
||||
(yyval.modifier).xor_max = (uint8_t) (yyvsp[-1].integer);
|
||||
}
|
||||
#line 2319 "grammar.c" /* yacc.c:1663 */
|
||||
break;
|
||||
@@ -2347,8 +2347,8 @@ yyreduce:
|
||||
fail_if_error(result);
|
||||
|
||||
(yyval.modifier).flags = STRING_FLAGS_XOR;
|
||||
(yyval.modifier).xor_min = (yyvsp[-3].integer);
|
||||
(yyval.modifier).xor_max = (yyvsp[-1].integer);
|
||||
(yyval.modifier).xor_min = (uint8_t) (yyvsp[-3].integer);
|
||||
(yyval.modifier).xor_max = (uint8_t) (yyvsp[-1].integer);
|
||||
}
|
||||
#line 2354 "grammar.c" /* yacc.c:1663 */
|
||||
break;
|
||||
|
||||
+4
-4
@@ -741,8 +741,8 @@ string_modifier
|
||||
fail_if_error(result);
|
||||
|
||||
$$.flags = STRING_FLAGS_XOR;
|
||||
$$.xor_min = $3;
|
||||
$$.xor_max = $3;
|
||||
$$.xor_min = (uint8_t) $3;
|
||||
$$.xor_max = (uint8_t) $3;
|
||||
}
|
||||
/*
|
||||
* Would love to use range here for consistency in the language but that
|
||||
@@ -777,8 +777,8 @@ string_modifier
|
||||
fail_if_error(result);
|
||||
|
||||
$$.flags = STRING_FLAGS_XOR;
|
||||
$$.xor_min = $3;
|
||||
$$.xor_max = $5;
|
||||
$$.xor_min = (uint8_t) $3;
|
||||
$$.xor_max = (uint8_t) $5;
|
||||
}
|
||||
| _BASE64_
|
||||
{
|
||||
|
||||
@@ -143,10 +143,10 @@ struct YR_ARENA
|
||||
// created, and can be incremented by calling yr_arena_acquire. On each call
|
||||
// to yr_arena_release it gets decremented by one, if xrefs reaches zero
|
||||
// the buffers and the YR_ARENA structures are freed.
|
||||
int xrefs;
|
||||
uint32_t xrefs;
|
||||
|
||||
// Number of buffers in this arena.
|
||||
int num_buffers;
|
||||
uint32_t num_buffers;
|
||||
|
||||
// Status of individual buffers.
|
||||
YR_ARENA_BUFFER buffers[YR_MAX_ARENA_BUFFERS];
|
||||
@@ -165,7 +165,7 @@ struct YR_ARENA
|
||||
// it. Initially each buffer is empty, the first time that some data is written
|
||||
// into a buffer at least initial_buffer_size are reserved for the buffer.
|
||||
int yr_arena_create(
|
||||
int num_buffers,
|
||||
uint32_t num_buffers,
|
||||
size_t initial_buffer_size,
|
||||
YR_ARENA** arena);
|
||||
|
||||
|
||||
@@ -1608,7 +1608,7 @@ void dotnet_parse_tilde(
|
||||
streams);
|
||||
}
|
||||
|
||||
void dotnet_parse_com(PE* pe, size_t base_address)
|
||||
void dotnet_parse_com(PE* pe)
|
||||
{
|
||||
PIMAGE_DATA_DIRECTORY directory;
|
||||
PCLI_HEADER cli_header;
|
||||
@@ -1795,7 +1795,7 @@ int module_load(
|
||||
|
||||
module_object->data = pe;
|
||||
|
||||
dotnet_parse_com(pe, block->base);
|
||||
dotnet_parse_com(pe);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -452,7 +452,7 @@ YR_API int yr_rules_get_stats(YR_RULES* rules, YR_RULES_STATS* stats)
|
||||
float match_list_length_sum = 0;
|
||||
int c = 0;
|
||||
|
||||
for (int i = 0; i < stats->ac_tables_size; i++)
|
||||
for (uint32_t i = 0; i < stats->ac_tables_size; i++)
|
||||
{
|
||||
int match_list_length = 0;
|
||||
|
||||
|
||||
+5
-4
@@ -36,9 +36,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <yara/libyara.h>
|
||||
#include <yara/limits.h>
|
||||
#include <yara/re.h>
|
||||
#include <yara/rules.h>
|
||||
#include <yara/scan.h>
|
||||
#include <yara/stopwatch.h>
|
||||
#include <yara/rules.h>
|
||||
#include <yara/types.h>
|
||||
#include <yara/utils.h>
|
||||
|
||||
@@ -546,7 +546,8 @@ static int _yr_scan_verify_chained_string_match(
|
||||
match->match_length = (int32_t)(
|
||||
match_offset - match->offset + match_length);
|
||||
|
||||
match->data_length = yr_min(match->match_length, max_match_data);
|
||||
match->data_length = yr_min(
|
||||
match->match_length, (int32_t) max_match_data);
|
||||
|
||||
match->data = yr_notebook_alloc(
|
||||
context->matches_notebook, match->data_length);
|
||||
@@ -584,7 +585,7 @@ static int _yr_scan_verify_chained_string_match(
|
||||
|
||||
// A copy of the matching data is written to the matches_arena, the
|
||||
// amount of data copies is limited by YR_CONFIG_MAX_MATCH_DATA.
|
||||
new_match->data_length = yr_min(match_length, max_match_data);
|
||||
new_match->data_length = yr_min(match_length, (int32_t) max_match_data);
|
||||
|
||||
if (new_match->data_length > 0)
|
||||
{
|
||||
@@ -702,7 +703,7 @@ static int _yr_scan_match_callback(
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
new_match->data_length = yr_min(match_length, max_match_data);
|
||||
new_match->data_length = yr_min(match_length, (int32_t) max_match_data);
|
||||
|
||||
if (new_match->data_length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user