Skip to content

Commit

Permalink
Fix incorrect conversion from int to size_t due to PR 66552. (dotnet#…
Browse files Browse the repository at this point in the history
…66721)

dotnet#66552 did incorrect switch
to size_t from int in a sections that expects variable to go negative.
  • Loading branch information
lateralusX authored Mar 16, 2022
1 parent 198942c commit a1f1ab8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/mono/mono/metadata/assembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -2139,10 +2139,8 @@ mono_assembly_request_load_from (MonoImage *image, const char *fname,
gchar *tmp_fn;

tmp_fn = g_strdup (fname);
for (size_t i = strlen (tmp_fn) - 1; i >= 0; i--) {
if (tmp_fn [i] == '/')
tmp_fn [i] = '\\';
}

g_strdelimit (tmp_fn, '/', '\\');

base_dir = absolute_dir (tmp_fn);
g_free (tmp_fn);
Expand Down
4 changes: 1 addition & 3 deletions src/mono/mono/metadata/icall.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,7 @@ is_generic_parameter (MonoType *type)
static void
mono_icall_make_platform_path (gchar *path)
{
for (size_t i = strlen (path); i > 0; i--)
if (path [i-1] == '\\')
path [i-1] = '/';
g_strdelimit (path, '\\', '/');
}

static const gchar *
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/metadata/w32handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ mono_w32handle_ops_prewait (MonoW32Handle *handle_data)
static void
mono_w32handle_unlock_handles (MonoW32Handle **handles_data, gsize nhandles)
{
for (gsize i = nhandles - 1; i >= 0; i--) {
for (int i = ((int)nhandles - 1); i >= 0; i--) {
if (!handles_data [i])
continue;
mono_w32handle_unlock (handles_data [i]);
Expand Down

0 comments on commit a1f1ab8

Please sign in to comment.