Skip to content

Commit

Permalink
ObjectHandleSerializer - GetObjectData should be marked as SecurityCr…
Browse files Browse the repository at this point in the history
…itical (#3660)
  • Loading branch information
snakefoot authored and 304NotModified committed Nov 4, 2019
1 parent 2bd4b4c commit 5c28ee7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/NLog/Internal/ObjectHandleSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,13 @@ protected ObjectHandleSerializer(SerializationInfo info, StreamingContext contex
catch (Exception ex)
{
_wrapped = string.Empty; // Type cannot be resolved in this AppDomain
InternalLogger.Info(ex, "ObjectHandleSerializer failed to deserialize object: {0}", type);
InternalLogger.Debug(ex, "ObjectHandleSerializer failed to deserialize object: {0}", type);
}
}

#if NET4_5
[System.Security.Permissions.SecurityPermissionAttribute(System.Security.Permissions.SecurityAction.LinkDemand, SerializationFormatter = true)]
#endif
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
try
Expand All @@ -95,7 +98,7 @@ public void GetObjectData(SerializationInfo info, StreamingContext context)
catch (Exception ex)
{
// ToString on random object can throw exception
InternalLogger.Info(ex, "ObjectHandleSerializer failed to serialize object: {0}", _wrapped?.GetType());
InternalLogger.Debug(ex, "ObjectHandleSerializer failed to serialize object: {0}", _wrapped?.GetType());
}
}

Expand All @@ -105,4 +108,4 @@ public object Unwrap()
}
}
#endif
}
}
3 changes: 1 addition & 2 deletions src/NLog/MappedDiagnosticsLogicalContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,4 @@ private static Dictionary<string, object> GetThreadLocal()
}
}

#endif

#endif

0 comments on commit 5c28ee7

Please sign in to comment.