MantisBT - NetSurf
View Issue Details
0002871NetSurf[All Projects] Generalpublic2024-03-21 07:502024-04-05 16:15
Assigned ToMichael Drake 
StatusclosedResolutionno change required 
PlatformOSGentoo LinuxOS Version
Product Version3.11 
Target VersionFixed in Version 
Fixed in CI build #
Reported in CI build #
URL of problem page
Summary0002871: Netsurf-gtk crashes on start due to NULL dereference
DescriptionNetsurf-gtk crashes on start every time. Valgrind (attached) points to a NULL dereference.

First I thought the crash was related to libparserutils being updated from 0.2.4 to 0.2.5, but when I rebuild 0.2.4 (or even 0.2.5 without the big change to handling buffers), netsurf still crashes. The stacktrace now shows libhubbub, even though its version hasn’t changed when I ran system update. Still, I tried going a version down (to 0.3.7), but netsurf still crashes and the stacktrace is the same. So I’m not really sure which component is to blame.
Additional InformationI don’t know whether related, but parserutils_buffer_randomise in src/utils/buffer.c (libparserutils) contains a bug, because new chunk of memory is allocated with size `buffer->length`, however, that might be less than `buffer->allocated`, leading to incorrect memory accesses.

Otherwise, the changes made in d101b2bb6dc98050f8f1b04d9d2bfeeff5a120c7 (libparserutils) look ok to me.
TagsNo tags attached.
Attached Fileslog valgrind.log (256,479) 2024-03-21 07:50
log libhubbub-valgrind.log (3,219) 2024-03-21 07:51

2024-03-21 07:51   
Attaching also the latter valgrind log.
Michael Drake   
2024-04-05 15:56   
It sounds like you have various NetSurf libs installed via your linux package manager? As shared libraries?

We don't support that because we won't make any ABI stability guarantees until they hit version 1.0.0. So for now, the libraries aren't currently intended to be used in this way.

What I guess might have happened here is that the `struct parserutils_buffer` which added a new member changed the ABI of libparserutils, and any libraries using it (hubbub, libcss, etc) will need to be rebuilt against the updated libparserutils.
2024-04-05 16:03   
I think your guess is probably correct. I couldn’t reproduce the crash in an isolated build from git and after a recent rebuild of my system, I can’t reproduce it with system netsurf either.

Thank you for your explanation, I’ll be smarter next time. :·)
Michael Drake   
2024-04-05 16:14   
No worries, thanks for letting us know!

Issue History
2024-03-21 07:50xHireNew Issue
2024-03-21 07:50xHireFile Added: valgrind.log
2024-03-21 07:51xHireFile Added: libhubbub-valgrind.log
2024-03-21 07:51xHireNote Added: 0002441
2024-04-05 15:56Michael DrakeNote Added: 0002442
2024-04-05 16:03xHireNote Added: 0002443
2024-04-05 16:14Michael DrakeNote Added: 0002444
2024-04-05 16:15Michael DrakeAssigned To => Michael Drake
2024-04-05 16:15Michael DrakeStatusnew => closed
2024-04-05 16:15Michael DrakeResolutionopen => no change required