libpkgconf/fragment.c


Log

Author Commit Date CI Message
Ariadne Conill 648a2249 2023-01-21T20:17:33 fragment: render: only include trailing space if there is another fragment
Ariadne Conill 5500a151 2022-08-16T18:46:43 fragment: avoid trying to merge fragments where data == NULL
Ariadne Conill 6c70781a 2022-07-26T18:00:22 introduce PKG_CONFIG_PKGCONF1_SYSROOT_RULES for legacy pkgconf behavior
Ariadne Conill 297e18f2 2022-07-26T17:08:48 tuple: add flags parameter to pkgconf_tuple_parse
Tobias Stoeckmann 100bc605 2020-05-30T23:48:40 libpkgconf: fragment: fix out of boundary write fragment_quote adds quotation to fragments if needed. It allocates a buffer and grows it as needed. Unfortunately the dst pointer is not updated after a realloc, which means that dst still points into the old memory area. Further writing characters into that area leads to out of boundy writes. Proof of concept: $ cat > poc.pc << EOF Name: poc Description: poc Version: 1 CFlags: -Ia CFlags: -I%%%%%%%%%%%%%%%%%%%%b CFlags: -I%%%%%%%%%%%%%%%%%%%%c CFlags: -Id EOF $ pkgconf --cflags poc.pc Most reliable attempt is to compile pkgconf with address sanitizer, but this file should lead to an abort on a glibc system due to modified chunk pointers (tested with Linux on amd64). But since this is undefined behaviour, it depends on system details.
Tobias Stoeckmann dc04193c 2020-05-29T19:35:42 libpkgconf: fragment: fix out of boundary read Parsing a fragment which consists only of a single dash leads to an out of boundary read. It duplicates the following entry which is not expected behaviour if another fragment follows. Proof of concept: $ cat > poc.pc << "EOF" Name: poc Description: poc Version: 1 Cflags: - -I/somewhere EOF $ PKG_CONFIG_PATH=. pkgconf --cflags poc -I/somewhere -I/somewhere If - is the last entry, it leads to an out of boundary read, which is easy to see if pkgconf is compiled with address sanitizer.
Vincent Torri 42b35531 2020-05-30T12:39:43 fix missing backslashes in paths on Windows According to https://docs.microsoft.com/fr-fr/windows/win32/fileio/naming-a-file backslashes (with slashes) are a path separator, hence must no be considered as an escape code. The first fix, in argvsplit.c, disables this. But because of fragment_quote(), the backslashes are doubled. Hence the second fix in fragment.c With this pc file : prefix=C:/Documents/msys2/opt/efl_64 libdir=${prefix}/lib includedir=${prefix}/include Name: eina Description: efl: eina Version: 1.24.99 Requires.private: iconv Libs: -L${libdir} -leina -pthread -levil Libs.private: -lpsapi -lole32 -lws2_32 -lsecur32 -luuid -lregex -lm Cflags:-I${includedir}/eina-1 -I${includedir}/efl-1 -I${includedir}/eina-1/eina -pthread pkgconf.exe --cflags eina returns : -IC:\Documents\msys2\opt\efl_64/include/eina-1 -IC:\Documents\msys2\opt\efl_64/include/efl-1 -IC:\Documents\msys2\opt\efl_64/include/eina-1/eina -pthread -DWINICONV_CONST= -IC:\Documents\msys2\opt\ewpi_64/include
Ariadne Conill 4fb7683c 2020-05-24T14:40:47 add support for the PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS flag used in build2.
William Pitcock 36a5b7ac 2019-01-14T13:48:02 libpkgconf: fragment: add pkgconf_fragment_copy_list()
William Pitcock d5fd74d7 2018-01-22T15:13:14 libpkgconf: fragment: revert the quoting changes, but not the lexing changes a few strange edge cases are causing problems (closes #168)
William Pitcock cf96c562 2017-12-14T22:41:14 libpkgconf: argvsplit: fix escape handling in tokenizer (closes #163)
William Pitcock 18abb4cc 2017-12-13T11:18:25 libpkgconf: fragment: fix nitpick warning reported by MSVC (closes #162)
William Pitcock 278a2bd6 2017-12-11T18:25:55 libpkgconf: fragment: rework quoting and lexing (closes #139, #153) we now use POSIX-style quoting for all fragments. it is our belief that this is the most optimal behaviour for portability, because all POSIX-compliant tools require single-quotes to be considered as literal (closes #153). because of this, we are able to remove some hacks on the lexer side which were there to simulate pkg-config quoting, but were basically utterly wrong (closes #139).
William Pitcock 72743575 2017-12-10T00:39:39 libpkgconf: fragment: track merged fragments, as they should never be quoted
William Pitcock cad2515b 2017-12-10T00:36:20 libpkgconf: fragment: there are no consumers of non-escaped rendered fragment lists, so deprecate the option
William Pitcock 19d91e90 2017-12-07T19:13:35 libpkgconf: fragment: allow for overriding the default fragment rendering behaviour
William Pitcock 4589274c 2017-10-16T12:56:19 libpkgconf: start to remove PKGCONF_BUFSIZE allocations from the stack. (closes #149) Patch by Karen Arutyunov.
William Pitcock 12973857 2017-10-16T12:51:59 libpkgconf: fragment: remove obsolete code in pkgconf_fragment_should_munge()
William Pitcock db56c80d 2017-09-23T00:11:37 libpkgconf: fragment: add debug to document post-subst output to parser
William Pitcock 7ced8d77 2017-09-19T21:48:53 libpkgconf: fragment: pkgconf_fragment_parse: return false on parse failure
William Pitcock 7786554b 2017-09-19T21:34:24 libpkgconf: fragment: check pkgconf_argv_split() return value
William Pitcock 56101390 2017-09-19T21:08:18 libpkgconf: fragment parsing: do not pass NULL to pkgconf_fragment_add()
William Pitcock e9fd43ca 2017-09-17T23:38:25 libpkgconf: clean up header includes (closes #137)
William Pitcock 906fef84 2017-09-08T20:09:12 libpkgconf: fragment: mark some inline match tables as const
William Pitcock 3c7f82a7 2017-05-09T19:38:57 fragment: also protect -nostdinc, -nostdlibinc, -nobuiltininc
William Pitcock 74eb74a3 2017-05-09T19:37:23 fragment: handle -include similarly to -isystem and -idirafter
William Pitcock 9fde4be1 2017-05-09T19:34:01 fragment: also protect -ansi, -std=, -stdlib=, -pedantic, -trigraphs, -Wa, and -Wp fragments
William Pitcock c7a8e1e3 2017-05-09T19:30:02 fragment: give -Wl fragments the same protection as -pthread
William Pitcock 90d52e6c 2017-05-05T01:40:57 fragment: add -pthread as a special fragment
William Pitcock 6e643aa4 2017-03-29T18:00:57 libpkgconf: hopefully the last necessary tweak to quoting...
William Pitcock e0c9569f 2017-02-25T15:53:50 fragment: add tracepoints
William Pitcock 01fe5743 2017-02-25T15:32:49 fragment: add new option to control escaping shell arguments
William Pitcock 647c0255 2017-02-03T13:17:21 libpkgconf: add PKGCONF_PKG_PKGF_DONT_RELOCATE_PATHS (#110) main: add PKG_CONFIG_DONT_RELOCATE_PATHS environment variable and --dont-relocate-paths option to disable path relocation
William Pitcock 13cf74c7 2017-01-19T18:23:25 libpkgconf: kill flags from top-level fragment API (ref #105)
William Pitcock 4f94090f 2017-01-18T20:25:19 libpkgconf: fragment: make pkgconf_fragment_filter() accept userdata (closes #106)
William Pitcock cb1dc71e 2017-01-13T20:10:02 fragment: simplify pkgconf_fragment_copy_munged()
William Pitcock 27c37105 2017-01-13T20:06:48 fragment: when munging, do a path relocation too
William Pitcock 7f6a1859 2017-01-13T19:55:54 fragment: only munge if sysroot_dir is actually set on cygwin/msys2, it is possible for munging to be enabled for other types of munging (instead of sysroot)
William Pitcock 4ba414f7 2017-01-07T15:04:34 fragment: handle oddball fragments like -framework more accurately
William Pitcock 0c690dc8 2016-12-30T12:39:10 libpkgconf: fragment: fix over-optimization of cflags/linker flags in edge cases involving non-standard options
William Pitcock ad1e414d 2016-12-30T02:47:42 libpkgconf: fragment: handle -idirafter in the same way as -isystem (https://bugs.freedesktop.org/show_bug.cgi?id=97337)
William Pitcock 6ef4a853 2016-12-21T20:06:17 libpkgconf: migrate pkgconf client fragment_is_system_dir() to a libpkgconf API
William Pitcock c7e505fe 2016-12-15T18:32:43 libpkgconf: fragment: split out per-fragment length calculation and use it for all render functions (buffer overrun hardening)
William Pitcock 63b3989f 2016-12-15T18:27:57 libpkgconf: document fragment module
William Pitcock 8213d910 2016-12-10T16:19:40 libpkgconf: migrate to using the pkgconf_ namespaced strlcat/strlcpy symbols
William Pitcock 0ae2d8e5 2016-12-10T15:47:21 fragment: fix off-by-one error in pkgconf_fragment_render_len()
William Pitcock d6d7ff77 2016-12-09T23:07:15 main: use pkgconf_fragment_render() to render fragment lists instead of custom stuff
William Pitcock 0232ee52 2016-12-09T22:18:59 libpkgconf: fragment: add pkgconf_fragment_filter() to selectively copy a fragment list using a filter function
William Pitcock 0baecbd1 2016-12-09T22:06:42 libpkgconf: fragment: mark fragment objects const in several internal functions
William Pitcock a9022030 2016-12-09T21:36:59 libpkgconf: fragment: simplify sysroot handling by using pkgconf_client_t.sysroot_dir presence
William Pitcock 8740c5cd 2016-12-01T15:05:03 libpkgconf: begin removing global state from libpkgconf library by introducing a "client" object which holds the state
William Pitcock ce165646 2016-10-25T13:57:42 fragment: skip empty tokens (closes #99) Due to the way that tokens are merged together for arguments which require explicit whitespace, an empty token could result in a fragment like: {.type = 'I', .data = '/usr/include '} Such a fragment would be treated differently than: {.type = 'I', .data = '/usr/include'} This difference causes the compiler to include a system include path as part of the additional includes, thus breaking things like include path shadowing, resulting in random build failures. As such, we skip empty tokens from the tokenizer as they do not have any relevance anyway.
William Pitcock b835d74d 2016-08-24T18:51:02 fragment: try to apply munging to all path-only fragments (#94)
William Pitcock f6c96fc3 2016-08-24T18:39:42 fragment: add pkgconf_fragment_should_munge() to simplify the munging logic a bit (#94)
William Pitcock f72e1c6d 2016-05-19T17:05:04 fragment: genericize the fragment merge determination and add support for -isystem (closes #87)
William Pitcock 06a45f1b 2015-09-06T11:45:00 libpkgconf: clean up PKG_ERRF and PKGF_ defines
William Pitcock 571d9c75 2015-09-06T11:29:56 libpkgconf: PKG_BUFSIZE becomes PKGCONF_BUFSIZE, remove unused PKG_MIN/PKG_MAX.
William Pitcock b17f2640 2015-09-06T10:48:24 libpkgconf: move some utility funcs into pkgconf_ namespace
William Pitcock 61d5fc72 2015-09-06T10:44:10 libpkgconf: move pkg_fragment to pkgconf_fragment namespace
William Pitcock 4c71b25d 2015-09-06T10:41:40 libpkgconf: move pkg_tuple to pkgconf_tuple namespace
William Pitcock cc2dcc1f 2015-09-06T10:31:21 libpkgconf: move pkg_node and pkg_list to pkgconf_node and pkgconf_list namespaces
William Pitcock a706b3dc 2015-09-06T09:35:08 initial libtoolization for libpkgconf