Issue Details (XML | Word | Printable)

Key: LOG4NET-69
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Nicko Cadell
Reporter: Ron Grabowski
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Log4net

Exception thrown when *Format methods are given a malformed format string

Created: 17/Mar/06 01:07 PM   Updated: 28/Mar/06 08:22 AM
Return to search
Component/s: None
Affects Version/s: 1.2.9
Fix Version/s: 1.2.10

Time Tracking:
Not Specified

Resolution Date: 28/Mar/06 08:22 AM


 Description  « Hide
FormatException thrown when *Format methods are given a malformed format string: log.DebugFormat("Malformed {{,,,5}format{8}!");

This statement:

 log.DebugFormat("Malformed {{,,,5}format{8}!");

throws the following exception:

[FormatException: Input string was not in a correct format.]
   System.Text.StringBuilder.FormatError()
   System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
   System.String.Format(IFormatProvider provider, String format, Object[] args)
   log4net.Core.LogImpl.DebugFormat(String format, Object[] args)

which is consistent with the documentation for String.Format:

System.FormatException: The format item in format is invalid. -or- The number indicating an argument to format is less than zero, or greater than or equal to the number of specified objects to format.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Nicko Cadell added a comment - 18/Mar/06 04:08 AM
Reduced length of summary as it formats better in the release notes

Nicko Cadell added a comment - 18/Mar/06 04:09 AM
version 1.2.10 does not actualy exist yet so this issue does not affect it. The issue exists in the latest source code at present but should hopefully be fixed shortly.

Nicko Cadell added a comment - 28/Mar/06 08:22 AM
This is fixed and i have added a test to ensure that malformed format strings don't leak exceptions.