Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FontDescription.LoadDescription throws NullReferenceException #97

Metalnem opened this issue Dec 24, 2018 · 1 comment

FontDescription.LoadDescription throws NullReferenceException #97

Metalnem opened this issue Dec 24, 2018 · 1 comment


Copy link

FontDescription.LoadDescription throws a NullReferenceException when loading the font from the attached archive. You can run the following code to reproduce it (the path variable should contain the path to the extracted file):


Found via SharpFuzz.

Copy link

Full stackrace:

System.NullReferenceException : Object reference not set to an instance of an object.
  NameTable.cs(31,0): at SixLabors.Fonts.Tables.General.NameTable.Load(BinaryReader reader)
  at SixLabors.Fonts.Tables.General.NameTable.Load(FontReader reader)
  at SixLabors.Fonts.Tables.TableLoader.Load[TTable](FontReader reader)
  at SixLabors.Fonts.FontReader.GetTable[TTableType]()
  at SixLabors.Fonts.FontDescription.LoadDescription(FontReader reader)
  at SixLabors.Fonts.FontDescription.LoadDescription(String path)

reader.GetReaderAtTablePosition(TableName) returns null and we don't check this at several places. Wonder if we should change the code here to throw an exception when header is null instead:

public virtual BinaryReader GetReaderAtTablePosition(string tableName)
    TableHeader header = this.GetHeader(tableName);
    return header?.CreateReader(;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants