Repository navigation
absPath: Explicitly check if path is empty before accessing it - #9934
Merged
Merged
Conversation
It is entirely possible for the path to be an empty string and many unit tests actually pass it as an empty string (e.g. both_roundrip or turnsEmptyPathIntoCWD). In this case, without this patch, absPath will perform a one-byte out-of-bounds access. This was discovered while enabling the nix test suite on Alpine where we compile all software with `-D_GLIBCXX_ASSERTIONS=1`, thus resulting in a test failure on Alpine.
algitbot
pushed a commit
to alpinelinux/aports
that referenced
this pull request
Feb 5, 2024
edolstra
enabled auto-merge
February 5, 2024 13:11
algitbot
pushed a commit
to alpinelinux/aports
that referenced
this pull request
Feb 5, 2024
This package is needed for the Nix test suite, it's really annoying to package as upstream doesn't tag releases and, therefore, also doesn't set an soname for the shared library. However, running the Nix test suite in Alpine is beneficial as it discovers bugs in Nix (see NixOS/nix#9934). See also: emil-e/rapidcheck#255
Contributor
|
@edolstra @thufschmitt @roberth can we please backport this to 2.20? Apologies for the mass ping, not sure who is the right person so I just looked at recent pulls' reviewers. |
Member
Yes! |
tebowy
pushed a commit
to tebowy/nix
that referenced
this pull request
Jul 11, 2024
absPath: Explicitly check if path is empty before accessing it (cherry picked from commit 6ec08b8) Change-Id: Ieeb53fb65d0e334e6017ceb3a48b3b6ae1047843
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This fixes UB in
absPath, UB is bad.Context
Within
absPath, it is entirely possible for the path to be an empty string and many unit tests actually pass it as an empty string (e.g. both_roundrip or turnsEmptyPathIntoCWD). In this case, without this patch,absPathwill perform a one-byte out-of-bounds access. This was discovered while enabling the nix test suite on Alpine where we compile all software with-D_GLIBCXX_ASSERTIONS=1, thus resulting in a test failure on Alpine.Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.