[PATCH 1/3] dwrite: Don't crash on uninitialized cached and factory fields in dwritefontface_Release

Piotr Caban piotr.caban at gmail.com
Thu Apr 27 09:51:32 CDT 2017


On 04/27/17 16:41, Nikolay Sivov wrote:
> On 27.04.2017 17:21, Piotr Caban wrote:
>> On 04/27/17 16:18, Nikolay Sivov wrote:
>>> By the way, did you check why init_font_data() fails? If it's because
>>> opentype_get_font_familyname() fails, I'm interested in a log, or font
>>> file that causes it.
>> Yes, the opentype_get_font_familyname was failing. Patch 2 fixes the
>> issue for the font I found it with. Do you want the log anyway?
>
> Yes, please send a log, or file itself directly to this address.
Here's the log (I've copied the font to tests and reproduced the issue 
there, the original log is way to big).
-------------- next part --------------
ccache gcc -m32 -c -o font.o font.c -I. -I../../../include -D__WINESRC__ -D_REENTRANT -fPIC -Wall -pipe \
  -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers \
  -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith \
  -Wlogical-op -gdwarf-2 -gstrict-dwarf -fno-omit-frame-pointer -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
../../../tools/winegcc/winegcc -o dwrite_test.exe.so -B../../../tools/winebuild -m32 -fasynchronous-unwind-tables \
  analyzer.o font.o layout.o testlist.o resource.res -ldwrite -lgdi32 -luser32 
../../../tools/runtest -q -P wine -T ../../.. -M dwrite.dll -p dwrite_test.exe.so font && touch font.ok
trace:dwrite:init_freetype FreeType version is 2.7.1
trace:dwrite:DWriteCreateFactory (1, {b859ee5a-d838-4b5b-a2e8-1adc7d93db48}, 0x32fc68)
trace:dwrite:dwritefactory_QueryInterface (0x126530)->({b859ee5a-d838-4b5b-a2e8-1adc7d93db48} 0x32fc68)
trace:dwrite:dwritefactory_AddRef (0x126530)->(2)
trace:dwrite:dwritefactory_Release (0x126530)->(1)
trace:dwrite:DWriteCreateFactory (1, {b859ee5a-d838-4b5b-a2e8-1adc7d93db48}, 0x32fc68)
trace:dwrite:dwritefactory_QueryInterface (0x126570)->({b859ee5a-d838-4b5b-a2e8-1adc7d93db48} 0x32fc68)
trace:dwrite:dwritefactory_AddRef (0x126570)->(2)
trace:dwrite:dwritefactory_Release (0x126570)->(1)
trace:dwrite:dwritefactory_RegisterFontCollectionLoader (0x126570)->((nil))
trace:dwrite:dwritefactory_UnregisterFontCollectionLoader (0x126570)->((nil))
trace:dwrite:dwritefactory_RegisterFontCollectionLoader (0x126570)->(0x126680)
trace:dwrite:dwritefactory_RegisterFontCollectionLoader (0x126570)->(0x1265b0)
trace:dwrite:dwritefactory_RegisterFontCollectionLoader (0x126570)->(0x126680)
trace:dwrite:dwritefactory_RegisterFontFileLoader (0x126570)->(0x7ef06b04)
trace:dwrite:dwritefactory_RegisterFontCollectionLoader (0x126570)->(0x32fcf4)
trace:dwrite:dwritefactory_CreateCustomFontCollection (0x126570)->(0x1265c8 0x7ea91aef 6 0x32fcbc)
trace:dwrite:dwritefactory_AddRef (0x126570)->(2)
trace:dwrite:dwritefactory_Release (0x126570)->(1)
trace:dwrite:dwritefactory_CreateCustomFontCollection (0x126570)->(0x126680 0x7ea91aef 6 0x32fcbc)
trace:dwrite:create_font_collection building font collection:
trace:dwrite:dwritefactory_AddRef (0x126570)->(2)
trace:dwrite:dwritefactory_AddRef (0x126570)->(3)
trace:dwrite:dwritefactory_Release (0x126570)->(2)
trace:dwrite:dwritefontcollection_Release (0x126648)->(0)
trace:dwrite:dwritefactory_Release (0x126570)->(1)
trace:dwrite:dwritefactory_CreateCustomFontCollection (0x126570)->(0x1265b0 0x7ea91aef 6 0x32fcbc)
trace:dwrite:create_font_collection building font collection:
trace:dwrite:dwritefactory_AddRef (0x126570)->(2)
trace:dwrite:dwritefontcollection_Release (0x126648)->(0)
trace:dwrite:dwritefactory_Release (0x126570)->(1)
trace:dwrite:dwritefactory_CreateCustomFontCollection (0x126570)->(0xdeadbeef 0x7ea91aef 6 0x32fcbc)
trace:dwrite:dwritefactory_CreateCustomFontCollection (0x126570)->(0x32fcf4 0x32fcf0 4 0x32fcbc)
trace:dwrite:dwritefactory_CreateCustomFontFileReference (0x126570)->(0x32fcf0 4 0x7ef06b04 0x32fbb8)
trace:dwrite:dwritefontfile_AddRef (0x126648)->(2)
trace:dwrite:dwritefontfile_Release (0x126648)->(1)
trace:dwrite:create_font_collection building font collection:
trace:dwrite:dwritefontfile_AddRef (0x126648)->(2)
trace:dwrite:dwritefontfile_Analyze (0x126648)->(0x32f9a0, 0x32f99c, 0x32f998, 0x32f9a8)
trace:dwrite:dwritefontfile_GetReferenceKey (0x126648)->(0x32ed34, 0x32ed38)
trace:dwrite:dwritefontfile_GetLoader (0x126648)->(0x32ed30)
trace:dwrite:dwritefontfile_AddRef (0x126648)->(3)
trace:dwrite:opentype_get_font_properties stretch=5, weight=400, style 0
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:opentype_decode_namerecord string L"Regular" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Regular" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Regular" for locale L"ja-JP" found
fixme:dwrite:opentype_decode_namerecord handle NAME format 1
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"ja-JP" found
fixme:dwrite:opentype_decode_namerecord handle NAME format 1
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:localizedstrings_Release (0x127110)->(0)
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"en-US" found
trace:dwrite:opentype_decode_namerecord string L"Ume UI Gothic" for locale L"ja-JP" found
fixme:dwrite:opentype_decode_namerecord handle NAME format 1
trace:dwrite:localizedstrings_Release (0x127110)->(0)
warn:dwrite:init_font_data unable to get family name from font
trace:dwrite:dwritefontfile_Release (0x126648)->(2)
trace:dwrite:dwritefontfile_AddRef (0x126648)->(3)
trace:dwrite:dwritefontfile_Release (0x126648)->(2)
trace:dwrite:dwritefontfile_Release (0x126648)->(1)
trace:dwrite:dwritefactory_AddRef (0x126570)->(2)
trace:dwrite:dwritefontfile_Release (0x126648)->(0)
trace:dwrite:dwritefontcollection_AddRef (0x126f78)->(2)
trace:dwrite:dwritefontcollection_Release (0x126f78)->(1)
trace:dwrite:dwritefontcollection_FindFamilyName (0x126f78)->(L"wine_test" 0x32fce8 0x32fcec)
font.c:2669: Test failed: got index -1
font.c:2670: Test failed: got exists 0
trace:dwrite:dwritefontcollection_GetFontFamilyCount (0x126f78)
font.c:2673: Test failed: got 0
trace:dwrite:dwritefontcollection_GetFontFamily (0x126f78)->(0 0x32fcc0)
font.c:2677: Test failed: got 0x80004005
wine: Unhandled page fault on read access to 0x00000000 at address 0x7ea76ee8 (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x7ea76ee8).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7ea76ee8 ESP:0032fc34 EBP:0032fc68 EFLAGS:00010202(  R- --  I   - - - )
 EAX:00000000 EBX:7ea9b000 ECX:00000a76 EDX:00000001
 ESI:00000000 EDI:00000001
Stack dump:
0x0032fc34:  7ea8ef13 0032fc78 7ea8e4c7 7ea8e4b9
0x0032fc44:  7ea9b000 0032fc68 7ea8e631 00000000
0x0032fc54:  7ea8ef13 7ea76edf 7ea9b000 80004005
0x0032fc64:  7ea91aac 0032fd18 7ea77b77 00000000
0x0032fc74:  7ea8ef13 80004005 7ea77901 7bcf8518
0x0032fc84:  7ea91af5 7ef06b04 0032fcf4 001265c8
Backtrace:
=>0 0x7ea76ee8 _expect_ref+0x18(obj=(nil), ref=0x1, line=0xa76) [/home/piotr/wine/wine32/dlls/dwrite/tests/font.c:101] in dwrite_test (0x0032fc68)
  1 0x7ea77b77 func_font+0x5d6() [/home/piotr/wine/wine32/dlls/dwrite/tests/font.c:2678] in dwrite_test (0x0032fd18)
  2 0x7ea7039f main+0x37e(argc=<is not available>, argv=<is not available>) [/home/piotr/wine/wine32/dlls/dwrite/tests/../../../include/wine/test.h:589] in dwrite_test (0x0032fdd8)
  3 0x7ea8edbf __wine_spec_exe_entry+0x6e(peb=<couldn't compute location>) [/home/piotr/wine/wine32/dlls/winecrt0/exe_entry.c:36] in dwrite_test (0x0032fe28)
  4 0x7b4606dc call_process_entry+0xb() in kernel32 (0x0032fe48)
  5 0x7b461724 start_process+0x73(entry=<couldn't compute location>) [/home/piotr/wine/wine32/dlls/kernel32/process.c:1116] in kernel32 (0x0032fe88)
  6 0x7bc836dc call_thread_func_wrapper+0xb() in ntdll (0x0032fea8)
  7 0x7bc8668d call_thread_func+0xfc(entry=0x7b4616b0, arg=0x7ea8ed50, frame=0x32ffc8) [/home/piotr/wine/wine32/dlls/ntdll/signal_i386.c:2759] in ntdll (0x0032ffa8)
  8 0x7bc836ba call_thread_entry_point+0x11() in ntdll (0x0032ffc8)
  9 0x7bc554c3 start_process+0x12(arg=0xffb103f4) [/home/piotr/wine/wine32/dlls/ntdll/loader.c:3054] in ntdll (0x0032ffe8)
  10 0xf75c6b2d wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000)
  11 0xf75c6c90 wine_switch_to_stack+0x1f(func=0x7bc554b0, arg=0xffb103f4, stack=0x330000) [/home/piotr/wine/wine32/libs/wine/port.c:77] in libwine.so.1 (0xffb103c8)
  12 0x7bc5b4ce LdrInitializeThunk+0x24d(kernel_start=<couldn't compute location>, unknown2=<couldn't compute location>, unknown3=<couldn't compute location>, unknown4=<couldn't compute location>) [/home/piotr/wine/wine32/dlls/ntdll/loader.c:3115] in ntdll (0xffb10418)
  13 0x7b4678aa __wine_kernel_init+0xa69() [/home/piotr/wine/wine32/dlls/kernel32/process.c:1310] in kernel32 (0xffb11588)
  14 0x7bc5c3a3 __wine_process_init+0x152() [/home/piotr/wine/wine32/dlls/ntdll/loader.c:3324] in ntdll (0xffb115f8)
  15 0xf75c4ce7 wine_init+0x2c6(argc=0x3, argv=0xffb11b54, error="", error_size=0x400) [/home/piotr/wine/wine32/libs/wine/loader.c:965] in libwine.so.1 (0xffb11658)
  16 0x7c000aa2 main+0x81(argc=<is not available>, argv=<is not available>) [/home/piotr/wine/wine32/loader/main.c:254] in <wine-loader> (0xffb11aa8)
  17 0xf73be57e __libc_start_main+0xdd() in libc.so.6 (0x00000000)
0x7ea76ee8 _expect_ref+0x18 [/home/piotr/wine/wine32/dlls/dwrite/tests/font.c:101] in dwrite_test: movl	0x0(%eax),%eax
101	    IUnknown_AddRef(obj);
Modules:
Module	Address			Debug info	Name (36 modules)
ELF	7b400000-7b7ea000	Dwarf           kernel32<elf>
  \-PE	7b410000-7b7ea000	\               kernel32
ELF	7bc00000-7bcf9000	Dwarf           ntdll<elf>
  \-PE	7bc10000-7bcf9000	\               ntdll
ELF	7c000000-7c004000	Dwarf           <wine-loader>
ELF	7e4f6000-7e51a000	Deferred        imm32<elf>
  \-PE	7e500000-7e51a000	\               imm32
ELF	7e526000-7e550000	Deferred        libexpat.so.1
ELF	7e556000-7e593000	Deferred        libfontconfig.so.1
ELF	7e596000-7e5d5000	Deferred        libpng16.so.16
ELF	7e5d6000-7e5e8000	Deferred        libbz2.so.1
ELF	7e5ee000-7e6a9000	Deferred        libfreetype.so.6
ELF	7e6f6000-7e76e000	Deferred        advapi32<elf>
  \-PE	7e700000-7e76e000	\               advapi32
ELF	7e76e000-7e899000	Deferred        gdi32<elf>
  \-PE	7e780000-7e899000	\               gdi32
ELF	7e89e000-7e9f3000	Deferred        user32<elf>
  \-PE	7e8b0000-7e9f3000	\               user32
ELF	7e9f6000-7ea5a000	Deferred        dwrite<elf>
  \-PE	7ea00000-7ea5a000	\               dwrite
ELF	7ea5e000-7ef07000	Dwarf           dwrite_test<elf>
  \-PE	7ea60000-7ef07000	\               dwrite_test
ELF	7ef0e000-7ef1a000	Deferred        libnss_files.so.2
ELF	7ef1e000-7ef2b000	Deferred        libnss_nis.so.2
ELF	7ef2e000-7ef48000	Deferred        libnsl.so.1
ELF	7ef4e000-7ef58000	Deferred        libnss_compat.so.2
ELF	7ef5e000-7efb2000	Deferred        libm.so.6
ELF	7efc6000-7efdf000	Deferred        libz.so.1
ELF	7efe6000-7f000000	Deferred        version<elf>
  \-PE	7eff0000-7f000000	\               version
ELF	f739e000-f73a3000	Deferred        libdl.so.2
ELF	f73a6000-f7551000	Dwarf           libc.so.6
ELF	f7556000-f7572000	Deferred        libpthread.so.0
ELF	f75be000-f7776000	Dwarf           libwine.so.1
ELF	f777e000-f77a2000	Deferred        ld-linux.so.2
ELF	f77a4000-f77a5000	Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) Z:\home\piotr\wine\wine32\dlls\dwrite\tests\dwrite_test.exe
	00000009    0 <==
0000000e services.exe
	0000002c    0
	0000002b    0
	00000027    0
	00000021    0
	0000001a    0
	00000017    0
	00000016    0
	00000014    0
	00000010    0
	0000000f    0
00000012 winedevice.exe
	00000020    0
	0000001d    0
	0000001c    0
	00000019    0
	00000018    0
	00000013    0
0000001e plugplay.exe
	00000024    0
	00000023    0
	0000001f    0
00000025 winedevice.exe
	00000031    0
	0000002e    0
	0000002d    0
	0000002a    0
	00000029    0
	00000026    0
0000002f explorer.exe
	00000035    0
	00000034    0
	00000033    0
	00000032    0
	00000030    0
System information:
    Wine build: wine-2.6-282-gfed3875
    Platform: i386
    Version: Windows 7
    Host system: Linux
    Host version: 4.9.16-gentoo
make: *** [Makefile:216: font.ok] Error 5


More information about the wine-devel mailing list