MantisBT - NetSurf
View Issue Details
0002119NetSurfAmiga-specificpublic2014-05-08 17:522015-03-10 11:02
ReporterChris Young 
Assigned ToChris Young 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformAmigaOSAmigaOSOS Version4.1
Product Version3.2 
Target Version3.2Fixed in Version3.2 
Fixed in CI build #1862
Reported in CI build #1855
URL of problem page
Summary0002119: Crash in amiga_vmkpath
DescriptionNetSurf crashes on startup in amiga_vmkpath()
Steps To ReproduceLaunch NetSurf.
Additional InformationStack trace:
    native kernel module newlib.library.kmod+0x00003164
    [amiga/gui.c:284] amiga_vmkpath()+0x124 (section 1 @ 0x10850)
    [amiga/gui.c:403] ami_gui_map_filename()+0x70 (section 1 @ 0x126AC)
    [amiga/gui.c:368] ami_locale_langs()+0xb4 (section 1 @ 0x12950)
    [amiga/gui.c:670] ami_set_options()+0x48 (section 1 @ 0x12A70)
    [utils/nsoption.c:527] nsoption_init()+0x6c (section 1 @ 0xF20F4)
    [amiga/gui.c:5292] main()+0x274 (section 1 @ 0x1D370)
    native kernel module newlib.library.kmod+0x000020ac
    native kernel module newlib.library.kmod+0x00002d5c
    native kernel module newlib.library.kmod+0x00002ef0
    _start()+0x170 (section 1 @ 0x16C)
    native kernel module dos.library.kmod+0x00024cd0
    native kernel module kernel+0x0003b4b0
    native kernel module kernel+0x0003b530
TagsNo tags attached.
Attached Filestxt Crashlog_NetSurf_2014-05-08_17-45-52.txt (3,170) 2014-05-08 17:52
https://bugs.netsurf-browser.org/mantis/file_download.php?file_id=133&type=bug

Notes
(0000321)
Vincent Sanders   
2014-05-08 18:19   
OK this is caused by my making the mkpath (used to be file_add_path go through the operations table.

I guess the core uses it before it is initialised.

the correct fix for this is to get the operation tables initialised as early as possible (instead of in ns_init() ). This also removes the need to have a NULL check in netsurf_mkpath() allowing it to be used withtin amiga/gui.c rather than having a separate amiga_mkpath()
(0000322)
Chris Young   
2014-05-08 18:44   
It appears to be the search for the Messages file which is causing the crash. This has to happen before ns_init as the path to Messages is passed to it, which ties in with what you have said.
(0000323)
Chris Young   
2014-05-08 19:50   
Calling gui_factory_register() just after nslog_init stops the crashing, but it still hangs and doesn't start up.
I suspect there's a memory trashing bug in vmkpath, but I can't immediately see anything wrong.
(0000324)
Chris Young   
2014-05-10 15:12   
CI build 1861 is giving me the same crash.

Stack trace:
    native kernel module newlib.library.kmod+0x00003164
    [amiga/gui.c:283] amiga_vmkpath()+0x124 (section 1 @ 0x10850)
    [amiga/gui.c:402] ami_gui_map_filename()+0x70 (section 1 @ 0x126AC)
    [amiga/gui.c:490] ami_locate_resource()+0x138 (section 1 @ 0x13268)
    [amiga/gui.c:5303] main()+0x2cc (section 1 @ 0x1D3C8)
    native kernel module newlib.library.kmod+0x000020ac
    native kernel module newlib.library.kmod+0x00002d5c
    native kernel module newlib.library.kmod+0x00002ef0
    _start()+0x170 (section 1 @ 0x16C)
    native kernel module dos.library.kmod+0x00024cd0
    native kernel module kernel+0x0003b4b0
    native kernel module kernel+0x0003b530

Line 283 which appears to be triggering this crash is actually a memmove:
[282] /* copy the first element complete */
[283] memmove(fname, elm[0], elm_len[0]);
[284] fname[elm_len[0]] = 0;
(0000325)
Chris Young   
2014-05-10 15:29   
Changed ami_gui_map_filename to leave amiga_mkpath to allocate the path buffer, rather than passing one to it.
(0000697)
Vincent Sanders   
2015-03-10 11:02   
Confirmed fixed in 3.2 release

Issue History
2014-05-08 17:52Chris YoungNew Issue
2014-05-08 17:52Chris YoungStatusnew => assigned
2014-05-08 17:52Chris YoungAssigned To => Chris Young
2014-05-08 17:52Chris YoungFile Added: Crashlog_NetSurf_2014-05-08_17-45-52.txt
2014-05-08 18:19Vincent SandersNote Added: 0000321
2014-05-08 18:19Vincent SandersAdditional Information Updatedbug_revision_view_page.php?rev_id=1205#r1205
2014-05-08 18:44Chris YoungNote Added: 0000322
2014-05-08 19:50Chris YoungNote Added: 0000323
2014-05-10 15:12Chris YoungNote Added: 0000324
2014-05-10 15:29Chris YoungFixed in CI build # => 1862
2014-05-10 15:29Chris YoungNote Added: 0000325
2014-05-10 15:29Chris YoungStatusassigned => resolved
2014-05-10 15:29Chris YoungFixed in Version => 3.2
2014-05-10 15:29Chris YoungResolutionopen => fixed
2015-03-10 11:02Vincent SandersNote Added: 0000697
2015-03-10 11:02Vincent SandersStatusresolved => closed