Commit Graph

21 Commits

Author SHA1 Message Date
Jan-Michael Brummer
e2dc3cd6d9 Do not replace file destination
Replacing file destination will also remove a symlink in case the user has moved the
real file to another location. Fix this by removing G_FILE_CREATE_REPLACE_DESTINATION flag.

See also: https://gitlab.gnome.org/GNOME/epiphany/issues/198
2020-02-07 13:05:33 +00:00
Michael Catanzaro
d83587b2a3 Fix gvdb_table_write_contents_async()
It worked when I first wrote it, but I broke it during the late stages
of code review. str is already freed here, so this is a use-after-free
vulnerability for starters. It also causes the file saved to be always
empty.
2019-06-27 16:58:03 -05:00
Michael Catanzaro
0d03b2c6dc Don't free FileBuilder in serialize function
It's confused both myself and Jan-Michael, when reviewing my changes to
this code. It's weird for the serialize function to take ownership of
the passed FileBuilder. Don't do that.

We can also add a convenience free function.
2019-06-22 13:23:09 -05:00
Philip Withnall
a6f0eadb51 Merge branch 'mcatanzaro/write-contents-async' into 'master'
Add gvdb_table_write_contents_async()

See merge request GNOME/gvdb!4
2019-06-21 17:08:24 +00:00
Michael Catanzaro
5b455175b4 Remove trailing whitespace 2019-06-21 10:11:08 -05:00
Michael Catanzaro
16fb81cd7e Add some g_return checks to gvdb_table_write_contents()
I'm not auditing all the public functions in this file for precondition
checks, but since I'm adding an async version of this function, it
makes sense to ensure there are matching checks for the sync version.
2019-06-21 10:04:49 -05:00
Michael Catanzaro
d12c5aaba8 Add gvdb_table_write_contents_async()
This is just an async version of gvdb_table_write_contents().

Future work: someone could write an async version of gvdb_table_new(),
then sync I/O would no longer be required to construct a GvdbTable.
2019-06-21 10:04:49 -05:00
Philip Withnall
c78664e101 Update FSF’s address
(This is based on commit 892fc2e4 from dconf.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 14:34:19 +01:00
Sébastien Wilmet
4763db8a4c gio/gvdb/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2018-08-13 14:34:19 +01:00
Philip Withnall
7fd9f61dbd Avoid calling Standard C string/array functions with NULL arguments
glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing
calls with NULL arguments to be treated as undefined behaviour.
This is consistent with ISO C99 and C11, which state that passing 0
to string functions as an array length does not remove the requirement
that the pointer to the array is a valid pointer.
gcc -fsanitize=undefined catches this while running OSTree's test suite.

Similarly, running the GLib test suite reports similar issues for
qsort(), memmove(), memcmp().

(This is a partial cherry-pick of commit e5ed410c8c from GLib.)

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2018-08-13 14:34:19 +01:00
Colin Walters
7683c2b796 builder: Note don't actually implement bloom filters 2012-03-08 11:30:03 -05:00
Ryan Lortie
92652ac791 hashing: always use signed chars
Our hashing of non-ASCII strings was undefined due to the fact that
'char' is signed on some platforms, unsigned on others.  Always use a
signed char.

Discovered by Alexander Larsson.

https://bugzilla.gnome.org/show_bug.cgi?id=658806
2011-09-12 08:12:44 -04:00
Ryan Lortie
a5dd6fcc4f builder: do not include <unistd.h> on win32
Spotted by Kean Johnston <kean.johnston@gmail.com>.

https://mail.gnome.org/archives/gtk-devel-list/2011-April/msg00010.html
2011-04-15 09:27:38 -04:00
Ryan Lortie
92c22e7ca7 Fix some leaks in the GVDB builder 2010-12-15 11:36:14 -05:00
Ryan Lortie
9a8cba9eb5 drop "options" support 2010-06-10 13:34:56 -04:00
Ryan Lortie
5215d4b6d3 Add API for dconf's sake. 2010-04-28 12:39:02 -05:00
Ryan Lortie
daa1a73c75 Add a missing 'static' on internal functions 2010-04-22 15:45:47 -04:00
Ryan Lortie
2d9811ebda Don't write out zero-byte sections in builder
This and the previous issue caught by Christian Persch in bug #616156
2010-04-19 10:28:44 -04:00
Ryan Lortie
6713b3dbaa Whitespace fixups 2010-04-19 10:18:44 -04:00
Ryan Lortie
caad55d726 Fix uninitialised header in the builder. 2010-04-16 11:04:15 -04:00
Ryan Lortie
0fec2048f0 Initial commit 2010-04-15 21:26:34 -04:00