File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44using System . IO ;
55using System . Reflection ;
66using System . Runtime . InteropServices ;
7+ using System . Text . RegularExpressions ;
78
89namespace Python . Runtime
910{
@@ -504,6 +505,13 @@ public static bool SuppressOverloads
504505 set { _SuppressOverloads = value ; }
505506 }
506507
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+
507515 [ ModuleFunction ]
508516 [ ForbidPythonThreads ]
509517 public static Assembly AddReference ( string name )
@@ -518,7 +526,8 @@ public static Assembly AddReference(string name)
518526 }
519527 if ( assembly == null )
520528 {
521- assembly = AssemblyManager . LoadAssembly ( name ) ;
529+ if ( IsValidAssemblyName ( name ) )
530+ assembly = AssemblyManager . LoadAssembly ( name ) ;
522531 }
523532 if ( assembly == null )
524533 {
You can’t perform that action at this time.
0 commit comments