Fix bitwise shift UB in filemap_fd on windows (#1489)

Fixes #1302
This commit is contained in:
Orycterope
2021-05-10 09:26:40 +02:00
committed by GitHub
parent 9f0c20ebb3
commit 397db256bc
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -80,7 +80,7 @@ YR_API int yr_filemap_map(const char* file_path, YR_MAPPED_FILE* pmapped_file)
YR_API int yr_filemap_map_fd(
YR_FILE_DESCRIPTOR file,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file)
{
@@ -110,7 +110,7 @@ YR_API int yr_filemap_map_fd(
return ERROR_COULD_NOT_OPEN_FILE;
}
if (offset > (off_t) file_size)
if (offset > (uint64_t) file_size)
return ERROR_COULD_NOT_MAP_FILE;
if (size == 0)
@@ -179,7 +179,7 @@ YR_API int yr_filemap_map_fd(
YR_API int yr_filemap_map_fd(
YR_FILE_DESCRIPTOR file,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file)
{
@@ -257,7 +257,7 @@ YR_API int yr_filemap_map_fd(
YR_API int yr_filemap_map_ex(
const char* file_path,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file)
{
@@ -291,7 +291,7 @@ YR_API int yr_filemap_map_ex(
YR_API int yr_filemap_map_ex(
const char* file_path,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file)
{
+2 -2
View File
@@ -61,14 +61,14 @@ YR_API int yr_filemap_map(const char* file_path, YR_MAPPED_FILE* pmapped_file);
YR_API int yr_filemap_map_fd(
YR_FILE_DESCRIPTOR file,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file);
YR_API int yr_filemap_map_ex(
const char* file_path,
off_t offset,
uint64_t offset,
size_t size,
YR_MAPPED_FILE* pmapped_file);