Closed Bug 565580 Opened 14 years ago Closed 14 years ago

Font fuzzer needs non-exported classes

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: pvnick, Unassigned)

Details

(Whiteboard: [sg:nse])

Attachments

(1 file, 1 obsolete file)

I'm currently writing a standalone font fuzzer that uses xpcom directly. I have to compile it as a tool while Firefox is compiling so I can use MOZILLA_INTERNAL_API and directly interface with font code. The only problem is that I get the following when compiling: test.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall gfxFontEntry::TestCharacterMap(unsigned int)" (?TestCharacterMap@gfxFontEntry@@UAEHI@Z) test.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __thiscall gfxFontEntry::ReadCMAP(void)" (?ReadCMAP@gfxFontEntry@@UAEIXZ) test.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall gfxFontEntry::~gfxFontEntry(void)" (??1gfxFontEntry@@UAE@XZ) referenced in function "public: virtual void * __thiscall gfxFontEntry::`scalar deleting destructor'(unsigned int)" (??_GgfxFontEntry@@UAEPAXI@Z) test.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall gfxFontFamily::LocalizedName(class nsAString_internal &)" (?LocalizedName@gfxFontFamily@@UAEXAAVnsAString_internal@@@Z) test.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall gfxFontFamily::HasOtherFamilyNames(void)" (?HasOtherFamilyNames@gfxFontFamily@@UAEHXZ) test.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall gfxFontFamily::ReadOtherFamilyNames(class gfxPlatformFontList *)" (?ReadOtherFamilyNames@gfxFontFamily@@UAEXPAVgfxPlatformFontList@@@Z) test.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall gfxFontFamily::ReadFaceNames(class gfxPlatformFontList *,int)" (?ReadFaceNames@gfxFontFamily@@UAEXPAVgfxPlatformFontList@@H@Z) test.obj : error LNK2001: unresolved external symbol "protected: virtual int __thiscall gfxFontFamily::FindWeightsForStyle(class gfxFontEntry * * const,int,short)" (?FindWeightsForStyle@gfxFontFamily@@MAEHQAPAVgfxFontEntry@@HF@Z) I added THEBES_API in the appropriate places for both classes, and it seems to work for gfxFontFamily, but when I try gfxFontEntry I get the following: c:\mozilla\mozcentral\ff-dbg\dist\include\nsTArray.h(200) : error C2558: class 'nsAutoPtr<T>' : no copy constructor available or copy constructor is declared 'explicit' with [ T=gfxSparseBitSet::Block ] c:\mozilla\mozcentral\ff-dbg\dist\include\nsTArray.h(915) : see reference to function template instantiation 'void nsTArrayElementTraits<E>::Construct<Item>(E *,const A &)' being compiled with [ E=nsAutoPtr<gfxSparseBitSet::Block>, Item=nsAutoPtr<gfxSparseBitSet::Block>, A=nsAutoPtr<gfxSparseBitSet::Block> ] c:\mozilla\mozcentral\ff-dbg\dist\include\nsTArray.h(502) : see reference to function template instantiation 'void nsTArray<E>::AssignRange<Item>(nsTArray_base::index_type,nsTArray_base::size_type,const Item *)' being compiled with [ E=nsAutoPtr<gfxSparseBitSet::Block>, Item=nsAutoPtr<gfxSparseBitSet::Block> ] c:\mozilla\mozcentral\ff-dbg\dist\include\nsTArray.h(297) : see reference to function template instantiation 'nsAutoPtr<T> *nsTArray<E>::ReplaceElementsAt<nsAutoPtr<T>>(nsTArray_base::index_type,nsTArray_base::size_type,const Item *,nsTArray_base::size_type)' being compiled with [ T=gfxSparseBitSet::Block, E=nsAutoPtr<gfxSparseBitSet::Block>, Item=nsAutoPtr<gfxSparseBitSet::Block> ] c:\mozilla\mozcentral\ff-dbg\dist\include\nsTArray.h(296) : while compiling class template member function 'nsTArray<E> &nsTArray<E>::operator =(const nsTArray<E> &)' with [ E=nsAutoPtr<gfxSparseBitSet::Block> ] c:\mozilla\mozcentral\ff-dbg\dist\include\gfxFontUtils.h(295) : see reference to class template instantiation 'nsTArray<E>' being compiled with [ E=nsAutoPtr<gfxSparseBitSet::Block> ]
Keywords: meta
Whiteboard: [sg:nse]
Why is this marked security-sensitive?
I suppose it doesn't have to be, but it relates to internal fuzzing tools so I decided to play it safe.
Attached file code (obsolete) —
Here's the source code of the file that causes the errors
Group: core-security
Keywords: meta
Attachment #445578 - Attachment is obsolete: true
Tada! Found a solution. I just added a static function within gfxPlatform in the Firefox source to do the actual loading and drawing of fonts. Pass in the font file data and some other stuff from a standalone xpcom glue app, and it will try the testcase. Diff file uploaded.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Glad you found a workaround; however, the compile error you saw with nsTArray<nsAutoPtr<Block>> worries me..... an nsTArray of nsAutoPtr seems like an inherently bad idea, so I want to look at this more closely anyway.
What's wrong with nsTArrays of nsAutoPtrs? They generally work well.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: