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
      it
      
      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
      0736b7c1
  2. 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
      instructions](https://github.com/codespell-project/codespell#user-content-updating
      
      ).
      
      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>
      00bfb3ab
  3. 24 Feb, 2020 1 commit
  4. 06 Sep, 2019 1 commit
  5. 15 Mar, 2019 1 commit
    • Emmanuel Fleury's avatar
      Fixing signedness in glib/giochannel.c · 2f9e6e97
      Emmanuel Fleury authored
      In file included from glib/glibconfig.h:9,
                       from glib/gtypes.h:32,
                       from glib/gquark.h:32,
                       from glib/gerror.h:28,
                       from glib/gconvert.h:32,
                       from glib/giochannel.h:32,
                       from glib/giochannel.c:37:
      glib/giochannel.c: In function ‘g_io_channel_write_chars’:
      glib/gmacros.h:351:26: error: comparison of integer expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’} and ‘gssize’ {aka ‘long int’} [-Werror=sign-compare]
       #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                ^
      glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
                 gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                                     ^~~
      glib/gmacros.h:351:41: error: operand of ?: changes signedness from ‘gssize’ {aka ‘long int’} to ‘gsize’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare]
       #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
                                               ^~~
      glib/giochannel.c:2285:31: note: in expansion of macro ‘MIN’
                 gssize write_this = MIN (space_in_buf, count - wrote_bytes);
                                     ^~~
      glib/giochannel.c:2415:41: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
                               g_assert (count == from_buf_len - from_buf_old_len);
                                               ^~
      glib/gmacros.h:455:25: note: in definition of macro ‘G_LIKELY’
       #define G_LIKELY(expr) (expr)
                               ^~~~
      glib/giochannel.c:2415:25: note: in expansion of macro ‘g_assert’
                               g_assert (count == from_buf_len - from_buf_old_len);
                               ^~~~~~~~
      2f9e6e97
  6. 08 Mar, 2019 1 commit
  7. 23 Oct, 2018 1 commit
    • Philip Withnall's avatar
      glib: Port various callers to use g_utf8_validate_len() · 1c421b01
      Philip Withnall authored
      
      
      These were callers which explicitly specified the string length to
      g_utf8_validate(), when it couldn’t be negative, and hence should be
      able to unconditionally benefit from the increased string handling
      length.
      
      At least one call site would have previously silently changed behaviour
      if called with strings longer than G_MAXSSIZE in length.
      
      Another call site was passing strlen(string) to g_utf8_validate(), which
      seems pointless: just pass -1 instead, and let g_utf8_validate()
      calculate the string length. Its behaviour on embedded nul bytes
      wouldn’t change, as strlen() stops at the first one.
      Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
      1c421b01
  8. 27 Apr, 2018 1 commit
  9. 06 Oct, 2017 1 commit
  10. 08 Sep, 2017 1 commit
  11. 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:
      
      	gbsearcharray.h
      	gconstructor.h
      	glibintl.h
      	gmirroringtable.h
      	gscripttable.h
      	gtranslit-data.h
      	gunibreak.h
      	gunichartables.h
      	gunicomp.h
      	gunidecomp.h
      	valgrind.h
      	win_iconv.c
      
      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
      
      https://bugzilla.gnome.org/show_bug.cgi?id=776504
      f9faac76
  12. 22 Nov, 2016 1 commit
  13. 12 Oct, 2016 1 commit
  14. 04 Jun, 2016 1 commit
  15. 12 Apr, 2016 1 commit
  16. 12 Mar, 2015 1 commit
  17. 04 Jul, 2014 1 commit
  18. 28 Jun, 2014 1 commit
    • Allison Karlitskaya's avatar
      giochannel: avoid setting uninitialised length · 00073761
      Allison Karlitskaya authored
      Our internal call to g_io_channel_read_line_backend() may return
      G_IO_STATUS_ERROR, in which case two things will be true:
      
       - the GError will have been set (if appropriate)
      
       - the &got_length return value may not have been set
      
      Since it's our convention to leave 'out' parameters untouched in
      exception cases, this is perfectly fine.  Unfortunately,
      g_io_channel_read_line(), in wrapping this internal function, always
      promotes the length parameter, even in the case of error.
      
      Stop doing that in order to avoid overwriting the callers's variable
      with junk in the error case.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=731339
      00073761
  19. 31 May, 2014 1 commit
  20. 20 Feb, 2014 1 commit
  21. 08 Feb, 2014 1 commit
  22. 06 Feb, 2014 1 commit
  23. 02 Feb, 2014 1 commit
  24. 01 Feb, 2014 2 commits
  25. 31 Jan, 2014 1 commit
  26. 20 Nov, 2013 1 commit
    • Dan Winship's avatar
      Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX · 158dde05
      Dan Winship authored
      In Windows development environments that have it, <unistd.h> is mostly
      just a wrapper around several other native headers (in particular,
      <io.h>, which contains read(), close(), etc, and <process.h>, which
      contains getpid()). But given that some Windows dev environments don't
      have <unistd.h>, everything that uses those functions on Windows
      already needed to include the correct Windows header as well, and so
      there is never any point to including <unistd.h> on Windows.
      
      Also, remove some <unistd.h> includes (and a few others) that were
      unnecessary even on unix.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=710519
      158dde05
  27. 15 Aug, 2013 1 commit
  28. 28 Nov, 2012 1 commit
  29. 01 Nov, 2012 1 commit
  30. 25 Oct, 2012 2 commits
    • Martin Pitt's avatar
      GIOChannel: Add missing annotations · 1775c46e
      Martin Pitt authored
      The various read and write methods have several out arguments which were not
      previously marked as such. Also, as GIOChannel supports binary data with a NULL
      encoding, the buffers need to be uint8 arrays instead of utf8 strings.
      1775c46e
    • Martin Pitt's avatar
      GIOChannel: Add missing (allow-none) annotations · c3f52eae
      Martin Pitt authored
      g_io_channel_set_line_term() and g_io_channel_set_encoding() can get NULL
      arguments, mark them as such.
      c3f52eae
  31. 28 Aug, 2012 2 commits
  32. 05 Apr, 2012 1 commit
  33. 31 Mar, 2012 1 commit
  34. 14 Dec, 2011 1 commit
  35. 03 Nov, 2011 1 commit
  36. 19 Oct, 2011 1 commit
  37. 09 Sep, 2011 1 commit