Fix case where EventPipeInternal::Enable is called with NULL output file. (#38927)
authorJohan Lorensson <lateralusx.github@gmail.com>
Wed, 8 Jul 2020 22:26:00 +0000 (00:26 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Jul 2020 22:26:00 +0000 (17:26 -0500)
src/mono/mono/metadata/icall-eventpipe.c

index 553aff2..97105ae 100644 (file)
@@ -248,11 +248,13 @@ ves_icall_System_Diagnostics_Tracing_EventPipeInternal_Enable (
 {
        ERROR_DECL (error);
        EventPipeSessionID session_id = 0;
+       char *output_file_utf8 = NULL;
 
        if (circular_buffer_size_mb == 0 || format > EP_SERIALIZATION_FORMAT_COUNT || providers_len == 0 || providers == NULL)
                return 0;
 
-       char *output_file_utf8 = mono_utf16_to_utf8 (output_file, g_utf16_len (output_file), error);
+       if (output_file)
+               output_file_utf8 = mono_utf16_to_utf8 (output_file, g_utf16_len (output_file), error);
 
        EventPipeProviderConfigurationNative *native_config_providers = (EventPipeProviderConfigurationNative *)providers;
        EventPipeProviderConfiguration *config_providers = g_new0 (EventPipeProviderConfiguration, providers_len);