In utils/nsurl.c the function nsurl__create_from_section() has a
section dealing with non-redundant ports (starting line 973).
lwc_intern_string() was being called with negative lengths and as it
takes a size_t (unsigned) so is getting passed a very large length
which causes a segfault.
this is supposed to be protected by the flag setting on line 969
however the arithmetic is all *unsigned* so the condition never
matches
(gdb) p length - (colon - pegs->at + skip)
$9 = 18446744073709551608
changing the check arithmetic to be a simple comparison against length
prevents this issue and reduces the amount of computation required.
This ensures newly created gtk gui windows have a default favicon
set. This is necessary because new tab creation displays the new
windows contents before an icon has been set and the icon will not be
changed from the previously viewed tabs icon.
This allows the languages resource to be read from file or from inline
data. Additionally it fixes a bug where the language combo box would
always be reset to en as the default regardless of what was currently
configured.
Any fetch start error was being reported as "out of memory" which was
clearly insufficient. Foe example bad urls (reported was file:// with
a missing /) were causing a warn_user with out of memory. This change
now at least causes a "bad url" message.
The GTK resource handling can now provide the path to resources rather
than having to compute them separately. This reduces run time
allocation and allows for the resources to be built in if required.
Additionally this tweaks the resource scheme handling to redirect
favicon.ico to resource:favicon.png instead of rewriting directly to
file scheme path allowing the favicon to be a compiled in resource.
The translated message loading is dependant on configuration of
resource location in each frontend, additionally they should have the
ability to deal with errors in this loading in a implementation
specific manner.
This also extends the message loading API to be capable of loading
from an inline memory buffer instead of from a file.
Previously this information was logged when netsurf_init was called
which might be many lines out output into the log.
It is useful to have this information at the beginning of the log to
make it easily found. In addition it makes netsurf_init less complex.
This adds API to obtain direct pointers to arrays of data from
compiled in resources. Additionally it hooks this up to provide data
for the resourece scheme handler.
This makes the GTK resource handling configurable in the same way as
all other pkg-config style feature options.
It is now possible to completely disable compiled in resources if
wanted as well as forcing inline pixdata on if desired.
Before GResource it was possible to compile pixbufs as inline
elements. This has historically been done for the menu cursor
only.
This change integrates the inline support and uses it when the
GResource support is not selected.
GTK UI builder resources have till now been exclusively stored on disc
requiring netsurf to ship numerous additional resource files. This
requires going to disc every time a UI action is performed which can
become a lot of unwanted file handling.
GLib/GTK has moved towards GResource handling for such resources
instead. It now seems that migrating to this style of usage is
expected and indeed the only portable way to include pixbufs.
This introduces an API to hide the various implementation details of
how resources are handled from the rest of the codebase.
This reduces logging overhead by only calling the log output function
once instead of three times.
Additionally the nslog_gettime interface no longer needs to be
exported and the static function is directly inlined further reducing
function call overhead.
Finally the appending of a newline uses fputc instead of a full printf
call which is considerably more simple and further reduces overhead
time.