You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
committed by
Jo Shields
parent
aa7da660d6
commit
c042cd0c52
@@ -39,6 +39,7 @@ namespace System.Runtime.Serialization
|
||||
if (!settingsInitalized)
|
||||
{
|
||||
NameValueCollection appSettingsSection = null;
|
||||
#if !NO_CONFIGURATION
|
||||
try
|
||||
{
|
||||
appSettingsSection = ConfigurationManager.AppSettings;
|
||||
@@ -48,13 +49,16 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
finally
|
||||
{
|
||||
#endif
|
||||
if ((appSettingsSection == null) || !int.TryParse(appSettingsSection[MaxMimePartsAppSettingsString], out maxMimeParts))
|
||||
{
|
||||
maxMimeParts = DefaultMaxMimeParts;
|
||||
}
|
||||
|
||||
settingsInitalized = true;
|
||||
#if !NO_CONFIGURATION
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,12 +6,15 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
using System;
|
||||
using System.Reflection;
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Security;
|
||||
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview (Critical) - works on CodeGenerator objects, which require Critical access.")]
|
||||
class BitFlagsGenerator
|
||||
{
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
int bitCount;
|
||||
CodeGenerator ilg;
|
||||
LocalBuilder[] locals;
|
||||
@@ -27,6 +30,7 @@ namespace System.Runtime.Serialization
|
||||
locals[i] = ilg.DeclareLocal(typeof(byte), localName + i, (byte) 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsBitSet(byte[] bytes, int bitIndex)
|
||||
{
|
||||
@@ -42,6 +46,7 @@ namespace System.Runtime.Serialization
|
||||
bytes[byteIndex] |= bitValue;
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
public int GetBitCount()
|
||||
{
|
||||
return bitCount;
|
||||
@@ -100,6 +105,7 @@ namespace System.Runtime.Serialization
|
||||
ilg.Stloc(local);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static byte GetBitValue(int bitIndex)
|
||||
{
|
||||
|
@@ -41,12 +41,16 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "XmlDictionaryString representing the XML namespaces for members of class."
|
||||
+ "Statically cached and used from IL generated code.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
XmlDictionaryString[] childElementNamespaces;
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds instance of CriticalHelper which keeps state that is cached statically for serialization. "
|
||||
+ "Static fields are marked SecurityCritical or readonly to prevent data from being modified or leaked to other components in appdomain.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
ClassDataContractCriticalHelper helper;
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Initializes SecurityCritical field 'helper'",
|
||||
@@ -60,7 +64,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Initializes SecurityCritical field 'helper'",
|
||||
Safe = "Doesn't leak anything.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecuritySafeCritical]
|
||||
#endif
|
||||
internal ClassDataContract(Type type)
|
||||
: base(new ClassDataContractCriticalHelper(type))
|
||||
{
|
||||
@@ -69,7 +75,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Initializes SecurityCritical field 'helper'",
|
||||
Safe = "Doesn't leak anything.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecuritySafeCritical]
|
||||
#endif
|
||||
ClassDataContract(Type type, XmlDictionaryString ns, string[] memberNames)
|
||||
: base(new ClassDataContractCriticalHelper(type, ns, memberNames))
|
||||
{
|
||||
@@ -77,7 +85,9 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Initializes SecurityCritical fields; called from all constructors.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical]
|
||||
#endif
|
||||
void InitClassDataContract()
|
||||
{
|
||||
this.helper = base.Helper as ClassDataContractCriticalHelper;
|
||||
@@ -449,6 +459,7 @@ namespace System.Runtime.Serialization
|
||||
return o;
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - calculates whether this class requires MemberAccessPermission for deserialization."
|
||||
+ "Since this information is used to determine whether to give the generated code access "
|
||||
+ "permissions to private members, any changes to the logic should be reviewed.")]
|
||||
@@ -653,10 +664,13 @@ namespace System.Runtime.Serialization
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing classes."
|
||||
+ " Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class ClassDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
ClassDataContract baseContract;
|
||||
|
@@ -9,7 +9,9 @@ namespace System.Runtime.Serialization
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Security;
|
||||
|
||||
class CodeGenerator
|
||||
|
@@ -12,7 +12,9 @@ namespace System.Runtime.Serialization
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
#if !NO_CONFIGURATION
|
||||
using System.Runtime.Serialization.Configuration;
|
||||
#endif
|
||||
using DataContractDictionary = System.Collections.Generic.Dictionary<System.Xml.XmlQualifiedName, DataContract>;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
@@ -473,7 +475,9 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing collections. Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class CollectionDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
static Type[] _knownInterfaces;
|
||||
@@ -1299,6 +1303,7 @@ namespace System.Runtime.Serialization
|
||||
return (InvalidCollectionInSharedContractMessage == null);
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
[Fx.Tag.SecurityNote(Miscellaneous =
|
||||
"RequiresReview - Calculates whether this collection requires MemberAccessPermission for deserialization."
|
||||
+ " Since this information is used to determine whether to give the generated code access"
|
||||
@@ -1391,6 +1396,7 @@ namespace System.Runtime.Serialization
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
internal override bool Equals(object other, Dictionary<DataContractPairKey, object> checkedContracts)
|
||||
{
|
||||
|
@@ -1 +1 @@
|
||||
119197239d535e7888f701cb6cd034205b1ec6e6
|
||||
68d510c66635a8bc1d30f6dcb6c0c9ab53137deb
|
@@ -339,6 +339,7 @@ namespace System.Runtime.Serialization
|
||||
ProcessedContracts.Add(dataContract, dataContract);
|
||||
}
|
||||
|
||||
#if !NO_CODEDOM
|
||||
internal ContractCodeDomInfo GetContractCodeDomInfo(DataContract dataContract)
|
||||
{
|
||||
object info;
|
||||
@@ -351,6 +352,7 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
ProcessedContracts.Add(dataContract, info);
|
||||
}
|
||||
#endif
|
||||
Dictionary<XmlQualifiedName, object> GetReferencedTypes()
|
||||
{
|
||||
if (referencedTypesDictionary == null)
|
||||
|
@@ -132,7 +132,9 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Critical.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class CriticalHelper
|
||||
{
|
||||
DataContract memberTypeContract;
|
||||
@@ -263,6 +265,7 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - checks member visibility to calculate if access to it requires MemberAccessPermission for serialization."
|
||||
+ " Since this information is used to determine whether to give the generated code access"
|
||||
+ " permissions to private members, any changes to the logic should be reviewed.")]
|
||||
@@ -304,6 +307,7 @@ namespace System.Runtime.Serialization
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
internal DataMember BindGenericParameters(DataContract[] paramContracts, Dictionary<DataContract, DataContract> boundContracts)
|
||||
{
|
||||
|
@@ -130,7 +130,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing enums."
|
||||
+ " Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class EnumDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
static Dictionary<Type, XmlQualifiedName> typeToName;
|
||||
|
@@ -41,7 +41,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds state used for deaing with generic parameters."
|
||||
+ " Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class GenericParameterDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
int parameterPosition;
|
||||
|
@@ -17,7 +17,9 @@ namespace System.Runtime.Serialization
|
||||
object GetCustomDataToExport(Type clrType, Type dataContractType);
|
||||
void GetKnownCustomDataTypes(Collection<Type> customDataTypes);
|
||||
Type GetReferencedTypeOnImport(string typeName, string typeNamespace, object customData);
|
||||
#if !NO_CODEDOM
|
||||
CodeTypeDeclaration ProcessImportedType(CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit);
|
||||
#endif
|
||||
}
|
||||
|
||||
static class DataContractSurrogateCaller
|
||||
@@ -68,9 +70,11 @@ namespace System.Runtime.Serialization
|
||||
return null;
|
||||
return surrogate.GetReferencedTypeOnImport(typeName, typeNamespace, customData);
|
||||
}
|
||||
#if !NO_CODEDOM
|
||||
internal static CodeTypeDeclaration ProcessImportedType(IDataContractSurrogate surrogate, CodeTypeDeclaration typeDeclaration, CodeCompileUnit compileUnit)
|
||||
{
|
||||
return surrogate.ProcessImportedType(typeDeclaration, compileUnit);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -118,9 +118,11 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing types."
|
||||
+ "Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
#pragma warning disable 618 // have not moved to the v4 security model yet
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#pragma warning restore 618
|
||||
#endif
|
||||
class JsonClassDataContractCriticalHelper : JsonDataContractCriticalHelper
|
||||
{
|
||||
JsonFormatClassReaderDelegate jsonFormatReaderDelegate;
|
||||
|
@@ -141,9 +141,11 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing types."
|
||||
+ "Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
#pragma warning disable 618 // have not moved to the v4 security model yet
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#pragma warning restore 618
|
||||
#endif
|
||||
class JsonCollectionDataContractCriticalHelper : JsonDataContractCriticalHelper
|
||||
{
|
||||
JsonFormatCollectionReaderDelegate jsonFormatReaderDelegate;
|
||||
|
@@ -138,9 +138,11 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing types."
|
||||
+ "Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
#pragma warning disable 618 // have not moved to the v4 security model yet
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#pragma warning restore 618
|
||||
#endif
|
||||
#if USE_REFEMIT
|
||||
public class JsonDataContractCriticalHelper
|
||||
#else
|
||||
|
@@ -64,9 +64,11 @@ namespace System.Runtime.Serialization.Json
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for (de)serializing types."
|
||||
+ "Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
#pragma warning disable 618 // have not moved to the v4 security model yet
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#pragma warning restore 618
|
||||
#endif
|
||||
class JsonEnumDataContractCriticalHelper : JsonDataContractCriticalHelper
|
||||
{
|
||||
bool isULong;
|
||||
|
@@ -6,7 +6,9 @@ namespace System.Runtime.Serialization.Json
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime;
|
||||
using System.Runtime.Serialization.Diagnostics.Application;
|
||||
using System.Security;
|
||||
@@ -17,7 +19,7 @@ namespace System.Runtime.Serialization.Json
|
||||
delegate object JsonFormatCollectionReaderDelegate(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContextComplexJson context, XmlDictionaryString emptyDictionaryString, XmlDictionaryString itemName, CollectionDataContract collectionContract);
|
||||
delegate void JsonFormatGetOnlyCollectionReaderDelegate(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContextComplexJson context, XmlDictionaryString emptyDictionaryString, XmlDictionaryString itemName, CollectionDataContract collectionContract);
|
||||
|
||||
sealed class JsonFormatReaderGenerator
|
||||
sealed partial class JsonFormatReaderGenerator
|
||||
{
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds instance of CriticalHelper which keeps state that was produced within an assert.")]
|
||||
[SecurityCritical]
|
||||
@@ -102,10 +104,11 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - handles all aspects of IL generation including initializing the DynamicMethod."
|
||||
+ "Changes to how IL generated could affect how data is deserialized and what gets access to data, "
|
||||
+ "therefore we mark it for review so that changes to generation logic are reviewed.")]
|
||||
class CriticalHelper
|
||||
partial class CriticalHelper
|
||||
{
|
||||
CodeGenerator ilg;
|
||||
LocalBuilder objectLocal;
|
||||
@@ -1106,6 +1109,7 @@ namespace System.Runtime.Serialization.Json
|
||||
UsingCustomParse
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,9 @@ namespace System.Runtime.Serialization.Json
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using System.Runtime.Serialization.Diagnostics.Application;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
@@ -13,7 +15,7 @@ namespace System.Runtime.Serialization.Json
|
||||
delegate void JsonFormatClassWriterDelegate(XmlWriterDelegator xmlWriter, object obj, XmlObjectSerializerWriteContextComplexJson context, ClassDataContract dataContract, XmlDictionaryString[] memberNames);
|
||||
delegate void JsonFormatCollectionWriterDelegate(XmlWriterDelegator xmlWriter, object obj, XmlObjectSerializerWriteContextComplexJson context, CollectionDataContract dataContract);
|
||||
|
||||
class JsonFormatWriterGenerator
|
||||
partial class JsonFormatWriterGenerator
|
||||
{
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds instance of CriticalHelper which keeps state that was produced within an assert.")]
|
||||
[SecurityCritical]
|
||||
@@ -70,10 +72,11 @@ namespace System.Runtime.Serialization.Json
|
||||
}
|
||||
}
|
||||
|
||||
#if !NO_DYNAMIC_CODEGEN
|
||||
[Fx.Tag.SecurityNote(Miscellaneous = "RequiresReview - handles all aspects of IL generation including initializing the DynamicMethod."
|
||||
+ "Changes to how IL generated could affect how data is deserialized and what gets access to data, "
|
||||
+ "therefore we mark it for review so that changes to generation logic are reviewed.")]
|
||||
class CriticalHelper
|
||||
partial class CriticalHelper
|
||||
{
|
||||
CodeGenerator ilg;
|
||||
ArgBuilder xmlWriterArg;
|
||||
@@ -800,5 +803,6 @@ namespace System.Runtime.Serialization.Json
|
||||
ilg.Call(xmlWriterArg, JsonFormatGeneratorStatics.WriteEndElementMethod);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,9 @@ namespace System.Runtime.Serialization
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Collections.Generic;
|
||||
#if !NO_CONFIGURATION
|
||||
using System.Runtime.Serialization.Configuration;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
|
||||
public sealed class NetDataContractSerializer : XmlObjectSerializer, IFormatter
|
||||
@@ -115,6 +117,9 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
if (unsafeTypeForwardingEnabled == null)
|
||||
{
|
||||
#if NO_CONFIGURATION
|
||||
unsafeTypeForwardingEnabled = false;
|
||||
#else
|
||||
NetDataContractSerializerSection section;
|
||||
if (NetDataContractSerializerSection.TryUnsafeGetSection(out section))
|
||||
{
|
||||
@@ -124,6 +129,7 @@ namespace System.Runtime.Serialization
|
||||
{
|
||||
unsafeTypeForwardingEnabled = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Fx.Assert(unsafeTypeForwardingEnabled != null, "unsafeTypeForwardingEnabled should not be null.");
|
||||
return unsafeTypeForwardingEnabled.Value;
|
||||
|
@@ -158,7 +158,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for for (de)serializing primitives."
|
||||
+ " Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class PrimitiveDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
MethodInfo xmlFormatWriterMethod;
|
||||
|
@@ -45,7 +45,9 @@ namespace System.Runtime.Serialization
|
||||
|
||||
[Fx.Tag.SecurityNote(Critical = "Holds all state used for for (de)serializing known types like System.Enum, System.ValueType, etc."
|
||||
+ " Since the data is cached statically, we lock down access to it.")]
|
||||
#if !NO_SECURITY_ATTRIBUTES
|
||||
[SecurityCritical(SecurityCriticalScope.Everything)]
|
||||
#endif
|
||||
class SpecialTypeDataContractCriticalHelper : DataContract.DataContractCriticalHelper
|
||||
{
|
||||
internal SpecialTypeDataContractCriticalHelper(Type type)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user