1. 04 Feb, 2021 1 commit
    • Philip Withnall's avatar
      glib: Use g_memdup2() instead of g_memdup() in obvious places · 0736b7c1
      Philip Withnall authored
      Convert all the call sites which use `g_memdup()`’s length argument
      trivially (for example, by passing a `sizeof()` or an existing `gsize`
      variable), so that they use `g_memdup2()` instead.
      In almost all of these cases the use of `g_memdup()` would not have
      caused problems, but it will soon be deprecated, so best port away from
      In particular, this fixes an overflow within `g_bytes_new()`, identified
      as GHSL-2021-045 by GHSL team member Kevin Backhouse.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <pwithnall@endlessos.org>
      Fixes: GHSL-2021-045
      Helps: #2319
  2. 02 Sep, 2020 1 commit
  3. 12 Jun, 2020 1 commit
    • Philip Withnall's avatar
      tree: Fix various typos and outdated terminology · 00bfb3ab
      Philip Withnall authored
      This was mostly machine generated with the following command:
      codespell \
          --builtin clear,rare,usage \
          --skip './po/*' --skip './.git/*' --skip './NEWS*' \
          --write-changes .
      using the latest git version of `codespell` as per [these
      Then I manually checked each change using `git add -p`, made a few
      manual fixups and dropped a load of incorrect changes.
      There are still some outdated or loaded terms used in GLib, mostly to do
      with git branch terminology. They will need to be changed later as part
      of a wider migration of git terminology.
      If I’ve missed anything, please file an issue!
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
  4. 24 Feb, 2020 1 commit
  5. 31 Jan, 2020 1 commit
  6. 10 Oct, 2019 1 commit
  7. 24 Aug, 2019 1 commit
  8. 20 May, 2019 5 commits
    • Allison Karlitskaya's avatar
      ghash: fix small array handling in g_hash_table_remove_all_nodes() · 11503333
      Allison Karlitskaya authored
      Factor out the code for setting up the hash table size, mask and mod,
      detecting valgrind and allocating the arrays for hashes, keys, and
      Make use of this new function from g_hash_table_remove_all_nodes().
      The handling of have_big_keys and have_big_values was never correct in
      this function because it reallocated the array without changing the
      flags in the struct.  Any calls in to the hashtable from destroy
      notifies would find the table in an inconsistent state.
      Many thanks to Thomas Haller who is essentially responsible for all the
      real work in this patch: both discovering and identifying the original
      problem, as well as finding the solution to it.
    • Allison Karlitskaya's avatar
      ghash: Be more explicit about memory in g_hash_table_destroy_all_nodes() · 9add93e5
      Allison Karlitskaya authored
      Make it clear that there is a reference transfer going on here, rather
      than relying on the fields being overwritten on each branch of the
      conditional below.
    • Allison Karlitskaya's avatar
      ghash: do less work when destroying the table · b3fbf6c1
      Allison Karlitskaya authored
      We were calling g_hash_table_set_shift() to reinitialise the hash table
      even in the case of destroying it.  Only do that for the non-destruction
      case, and fill the relevant fields with zeros for the destruction case.
      This has a nice side effect of causing more certain crashes in case of
      invalid reuse of the table after (or during) destruction.
    • Allison Karlitskaya's avatar
      ghash: Improve internal documentation · c5462cb3
      Allison Karlitskaya authored
      The changes introduced by 18745ff6 made
      the comment at the top of g_hash_table_remove_all_nodes() no longer
      correct.  Fix that inaccuracy and add more documentation all-around.
    • Allison Karlitskaya's avatar
      ghash: fix bug introduced by valgrind fix · 96ce9202
      Allison Karlitskaya authored
      g_hash_table_new_full() had an invocation of
      g_hash_table_realloc_key_or_value_array() with the @is_big argument
      incorrectly hardcoded to FALSE, even though later in the function the
      values of have_big_keys and have_big_values would be set conditionally.
      This never caused problems before because on 64bit platforms, this would
      result in the allocation of a guint-sized array (which would be fine, as
      have_big_keys and have_big_values would always start out as false) and
      on 32bit platforms, this function ignored the value and always allocated
      a gpointer-sized array.
      Since merge request !845 we have the possibility for
      have_big_keys and have_big_values to start out as TRUE on 64bit
      platforms.  We need to make sure we pass the argument through correctly.
  9. 14 May, 2019 1 commit
  10. 30 Apr, 2019 1 commit
    • Emmanuele Bassi's avatar
      Add a version check for duplicated-branches warning · 6cb6b418
      Emmanuele Bassi authored
      The GHashTable code ignores the duplicated-branches GCC warning, but we
      need to do a compiler and version check, as either non-GCC compatible
      compilers, or older versions of GCC will warn about the unknown pragma
      or diagnostic.
      If we don't do this while turning warnings into error, we're going to
      fail the build unnecessarily.
  11. 26 Apr, 2019 1 commit
  12. 17 Mar, 2019 1 commit
  13. 18 Dec, 2018 1 commit
  14. 12 Oct, 2018 1 commit
  15. 03 Oct, 2018 4 commits
  16. 17 Sep, 2018 2 commits
    • Hans Petter Jansson's avatar
      ghash: Simplify g_hash_table_set_shift() · 171f698e
      Hans Petter Jansson authored
      Even if we're using a prime modulo for the initial probe, our table is
      power-of-two-sized, meaning we can set the mask simply by subtracting one
      from the size.
    • Hans Petter Jansson's avatar
      ghash: Fix poor performance with densely populated keyspaces · 0dee6297
      Hans Petter Jansson authored
      Sequential integers would be densely packed in the table, leaving the
      high-index buckets unused and causing abnormally long probes for many
      operations. This was especially noticeable with failed lookups and
      when "aging" the table by repeatedly inserting and removing integers
      from a narrow range using g_direct_hash() as the hashing function.
      The solution is to multiply the hash by a small prime before applying
      the modulo. The compiler optimizes this to a few left shifts and adds, so
      the constant overhead is small, and the entries will be spread out,
      yielding a lower average probe count.
  17. 31 Aug, 2018 1 commit
  18. 14 Jun, 2018 1 commit
  19. 11 Jun, 2018 1 commit
  20. 08 May, 2018 1 commit
  21. 15 Feb, 2018 1 commit
  22. 12 Jan, 2018 1 commit
  23. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      All glib/*.{c,h} files have been processed, as well as gtester-report.
      12 of those files are not licensed under LGPL:
      Some of them are generated files, some are licensed under a BSD-style
      license and win_iconv.c is in the public domain.
      Sub-directories inside glib/:
      	deprecated/: processed in a previous commit
      	glib-mirroring-tab/: already LGPLv2.1+
      	gnulib/: not modified, the code is copied from gnulib
      	libcharset/: a copy
      	pcre/: a copy
      	tests/: processed in a previous commit
  24. 02 May, 2017 1 commit
  25. 28 Apr, 2017 1 commit
    • Philip Withnall's avatar
      docs: Fix (nullable) (optional) annotations · b63469d7
      Philip Withnall authored
      There are a few places where commit 18a33f72
       replaced valid (nullable)
      (optional) annotations with just (optional). That has a different
      (nullable) (optional) can only be applied to gpointer* parameters, and
      means that both the gpointer* and returned gpointer can be NULL. i.e.
      The caller can pass in NULL to ignore the return value; and the returned
      value can be NULL.
      (optional) can be applied to anything* parameters, and means that the
      anything* can be NULL. i.e. The caller can pass in NULL to ignore the
      return value. The return value cannot be NULL.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
  26. 23 Mar, 2017 2 commits
  27. 22 Nov, 2016 1 commit
  28. 07 Nov, 2015 3 commits
  29. 27 Jul, 2015 1 commit