dimanche 20 avril 2014

c# - AssemblyName.Version peut lever une erreur ? -Débordement de pile


I want to know if AssemblyName.Version could ever encounter an error, for example when trying to retrieve it from the manifest file.


can I manually modify the assembly version somewhere outside the VS (e.g. a text editor) for a file and put in an invalid version format so that when trying to retrieve and compare it with another version I would get an exception of some sort.


if such an edit is possible, would this AssemblyName.GetAssemblyName("path") succeed?




MajorVersion, MinorVersion, BuildNumber and RevisionNumber are stored in the assembly with 2 bytes each. Someone determined could change these values, but there is no possible 'invalid' value, because each 2 byte value is interpreted as an unsigned integer between in the range 0 to UInt16.MaxValue - 1


As such, altering these values in the (unsigned) assembly would simply change the apparent version of the assembly.


The property AssemblyName.Version simply returns the value of the field populated when the assembly is loaded, and can not throw an exception.


That's not to say you couldn't corrupt your assembly in other ways...



I want to know if AssemblyName.Version could ever encounter an error, for example when trying to retrieve it from the manifest file.


can I manually modify the assembly version somewhere outside the VS (e.g. a text editor) for a file and put in an invalid version format so that when trying to retrieve and compare it with another version I would get an exception of some sort.


if such an edit is possible, would this AssemblyName.GetAssemblyName("path") succeed?



MajorVersion, MinorVersion, BuildNumber and RevisionNumber are stored in the assembly with 2 bytes each. Someone determined could change these values, but there is no possible 'invalid' value, because each 2 byte value is interpreted as an unsigned integer between in the range 0 to UInt16.MaxValue - 1


As such, altering these values in the (unsigned) assembly would simply change the apparent version of the assembly.


The property AssemblyName.Version simply returns the value of the field populated when the assembly is loaded, and can not throw an exception.


That's not to say you couldn't corrupt your assembly in other ways...


0 commentaires:

Enregistrer un commentaire