nix-super/src/libexpr
Sergei Trofimovich b74962c92b src/libexpr/search-path.cc: avoid out-of-bounds read on string_view
Without the change build with `-D_GLIBCXX_ASSERTIONS` exposes testsuite
assertion:

    $ gdb src/libexpr/tests/libnixexpr-tests
    Reading symbols from src/libexpr/tests/libnixexpr-tests...
    (gdb) break __glibcxx_assert_fail
    (gdb) run
    (gdb) bt
    in std::__glibcxx_assert_fail(char const*, int, char const*, char const*)@plt () from /mnt/archive/big/git/nix/src/libexpr/libnixexpr.so
    in std::basic_string_view<char, std::char_traits<char> >::operator[] (this=0x7fffffff56c0, __pos=4)
        at /nix/store/r74fw2j8rx5idb0w8s1s6ynwwgs0qmh9-gcc-14.0.0/include/c++/14.0.0/string_view:258
    in nix::SearchPath::Prefix::suffixIfPotentialMatch (this=0x7fffffff5780, path=...) at src/libexpr/search-path.cc:15
    in nix::SearchPathElem_suffixIfPotentialMatch_partialPrefix_Test::TestBody (this=0x555555a17540) at src/libexpr/tests/search-path.cc:62

As string sizes are usigned types `(a - b) > 0` effectively means
`a != b`. While the intention should be `a > b`.

The change fixes test suite pass.
2023-08-14 22:07:37 +01:00
..
flake Merge pull request #8769 from edolstra/generalize-tarball-urls 2023-08-07 17:02:17 +02:00
primops Make the Derived Path family of types inductive for dynamic derivations 2023-08-10 00:08:32 -04:00
tests Rework evaluator SingleDerivedPath infra 2023-08-14 08:44:50 -04:00
value Make the Derived Path family of types inductive for dynamic derivations 2023-08-10 00:08:32 -04:00
attr-path.cc Merge remote-tracking branch 'origin/master' into source-path 2023-04-24 13:20:36 +02:00
attr-path.hh Merge remote-tracking branch 'upstream/master' into source-path 2023-04-17 11:41:50 +02:00
attr-set.cc Don't pass Symbol by reference 2022-04-26 13:25:17 +02:00
attr-set.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
eval-cache.cc Make the Derived Path family of types inductive for dynamic derivations 2023-08-10 00:08:32 -04:00
eval-cache.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
eval-inline.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
eval-settings.cc Factor out nix-defexpr path computation 2023-08-02 12:54:48 -04:00
eval-settings.hh Factor out nix-defexpr path computation 2023-08-02 12:54:48 -04:00
eval.cc Rework evaluator SingleDerivedPath infra 2023-08-14 08:44:50 -04:00
eval.hh Rework evaluator SingleDerivedPath infra 2023-08-14 08:44:50 -04:00
fetchurl.nix fetchurl.nix: change other use of __impure 2022-09-16 01:54:24 -07:00
function-trace.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
function-trace.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
get-drvs.cc Use std::set<StringContextElem> not PathSet for string contexts 2023-04-21 01:05:49 -04:00
get-drvs.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
imported-drv-to-derivation.nix Move some corepkgs into the nix binary 2020-03-11 16:57:48 +01:00
json-to-value.cc return string_views from forceString* 2022-01-27 17:15:43 +01:00
json-to-value.hh Ensure all headers have #pragma once and are in API docs 2023-03-31 23:19:44 -04:00
lexer.l libexpr: use thread_local to make the parser thread-safe 2023-07-03 16:05:43 +08:00
local.mk Enable -Werror=switch-enum 2023-04-03 18:45:20 +02:00
nix-expr.pc.in Fix building with GCC 9 2023-02-10 18:38:57 +01:00
nixexpr.cc Merge remote-tracking branch 'upstream/master' into source-path 2023-04-17 11:41:50 +02:00
nixexpr.hh Merge remote-tracking branch 'upstream/master' into source-path 2023-04-17 11:41:50 +02:00
parser.y Move evaluator settings (type and global) to separate file/header 2023-07-31 10:14:15 -04:00
paths.cc Backport SourcePath from the lazy-trees branch 2023-04-06 13:15:50 +02:00
primops.cc Create outputOf primop. 2023-08-14 09:37:37 -04:00
primops.hh Automatically document builtin constants 2023-06-27 09:37:54 -04:00
print.cc libexpr: quote reserved keys when printing 2023-05-09 09:45:12 -05:00
print.hh libexpr: quote reserved keys when printing 2023-05-09 09:45:12 -05:00
search-path.cc src/libexpr/search-path.cc: avoid out-of-bounds read on string_view 2023-08-14 22:07:37 +01:00
search-path.hh Clean up SearchPath 2023-07-09 23:22:22 -04:00
symbol-table.hh Finish converting existing comments for internal API docs (#8146) 2023-04-07 13:55:28 +00:00
value-to-json.cc toJSON: Add attribute path to trace 2023-07-31 13:02:54 +02:00
value-to-json.hh Use std::set<StringContextElem> not PathSet for string contexts 2023-04-21 01:05:49 -04:00
value-to-xml.cc Merge remote-tracking branch 'origin/master' into source-path 2023-04-24 13:20:36 +02:00
value-to-xml.hh Use std::set<StringContextElem> not PathSet for string contexts 2023-04-21 01:05:49 -04:00
value.hh Merge pull request #8566 from inclyc/nixd/value-print-depth 2023-07-01 20:08:52 +02:00