File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 4
4
using System . IO ;
5
5
using System . Reflection ;
6
6
using System . Runtime . InteropServices ;
7
+ using System . Text . RegularExpressions ;
7
8
8
9
namespace Python . Runtime
9
10
{
@@ -504,6 +505,13 @@ public static bool SuppressOverloads
504
505
set { _SuppressOverloads = value ; }
505
506
}
506
507
508
+ private static bool IsValidAssemblyName ( string name )
509
+ {
510
+ string typeName = name . Split ( ',' ) [ 0 ] ;
511
+ if ( typeName . Contains ( Path . DirectorySeparatorChar ) ) return false ;
512
+ return true ;
513
+ }
514
+
507
515
[ ModuleFunction ]
508
516
[ ForbidPythonThreads ]
509
517
public static Assembly AddReference ( string name )
@@ -518,7 +526,8 @@ public static Assembly AddReference(string name)
518
526
}
519
527
if ( assembly == null )
520
528
{
521
- assembly = AssemblyManager . LoadAssembly ( name ) ;
529
+ if ( IsValidAssemblyName ( name ) )
530
+ assembly = AssemblyManager . LoadAssembly ( name ) ;
522
531
}
523
532
if ( assembly == null )
524
533
{
You can’t perform that action at this time.
0 commit comments